我正在尝试使用 kiip 库来做到这一点:
http://docs.xamarin.com/ios/advanced_topics/binding_objective-c_types
我收到一条错误消息,说找不到我的绑定项目,但是,我确实在项目中添加了对它的引用。
我是否使用这样的代码:
public override void ViewDidLoad ()
{
var kp = new KiipMonoTouchBinding.IKPManager();
kp.InitWithKey("abc", "123");
}
我这样做正确吗?
namespace KiipMonoTouchBinding
{
interface IKPManager
{
//kiip code
//KPManager* manager = [[KPManager alloc] initWithKey:@"0b56b49f621ad7f42fd85de7e461f9dd" secret:@"ac3abfdf5cb86ce0febba0c8afd2744e" testFrequency:100];
[Export("initWithKey:")]
void InitWithKey(string key, string secret);
//[[KPManager sharedManager] unlockAchievement:@"_achievement_id_"];
[Export ("unlockAchievement:")]
void UnlockAchievement(string achivementId);
//
//- (IBAction)saveLeaderboard {
// NSLog(@"save leaderboard");
// [[KPManager sharedManager] updateScore:100 onLeaderboard:leaderboard_id.text];
//}
//[[KPManager sharedManager] updateScore:_score_ onLeaderboard:@"_leaderboard_id_"];
[Export("updateScore:")]
void UpdateScore(int score, string leaderboardId);
//- manager:(KPManager*)manager didStartSession:(NSDictionary*)response {
[Export("didStartSession:response")]
void DidStartSession(NSDictionary response);
//updateLatitude:(double)37.7753 longitude:(double)-122.4189];
[Export("updateLatitude:_latitude, longitude")]
void UpdateLatitude(double latitude, double longitude);
[Export("updateUserInfo:info")]
void UpdateUserInfo(NSDictionary info);
// [[KPManager sharedManager] getActivePromos];
[Export("getActivePromos")]
void GetActivePromos();
// Update the user's location
// [manager updateLatitude:_latitude_ longitude:_longitude_];
// Update the User's information
// NSDictionary* info = [[[NSDictionary alloc] initWithObjectsAndKeys:
// _email_, @"email",
// _alias_, @"alias",
// nil]
// autorelease];
// [manager updateUserInfo:info];
}