使用iOS SDK为游戏创建Facebook Graph API成就
我目前正在开发一款没有画布版本的游戏。它可以在iOS和Android平台上玩。我需要使用游戏成就对象。我跟着。我无法理解meta标记。实际上,我启动了自己的服务器,创建了一个.html文件,内容如所示。我将“将您自己的URL放到此处的对象”替换为http://192.168.2.6:8888/facebooktest/achivement.html. 我使用的代码使用iOS SDK为游戏创建Facebook Graph API成就,ios,facebook,facebook-graph-api,facebook-ios-sdk,Ios,Facebook,Facebook Graph Api,Facebook Ios Sdk,我目前正在开发一款没有画布版本的游戏。它可以在iOS和Android平台上玩。我需要使用游戏成就对象。我跟着。我无法理解meta标记。实际上,我启动了自己的服务器,创建了一个.html文件,内容如所示。我将“将您自己的URL放到此处的对象”替换为http://192.168.2.6:8888/facebooktest/achivement.html. 我使用的代码 - (IBAction)updateAchivement:(id)sender { NSDictionar
- (IBAction)updateAchivement:(id)sender {
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"****888****3612", @"fb:app_id",
@"game.achievement", @"og:type",
@"http://192.168.2.6:8888/facebooktest/achivement.html", @"og:url",
@"Sample Game Achievement", @"og:title",
@"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png", @"og:image",
@"1000", @"game:points",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:@"/me/objects/" //game.achievement
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
if (error) {
NSLog(@"%@",error);
}
else
NSLog(@"Result = %@",result);
}];
}
这是我收到的日志
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x8d21ef0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) The parameter object is required";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x8e2ebd0, state: FBSessionStateOpenTokenExtended, loginHandler: 0x8e31d40, appID: 605088866273612, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x8e33240>, expirationDate: 2014-09-22 13:31:23 +0000, refreshDate: 2014-07-25 11:24:16 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
installed,
"public_profile",
email,
"publish_actions",
"user_friends"
)>}`
我不知道出了什么问题。请帮忙 您应该更正这一行:
[FBRequestConnection startWithGraphPath:@"/me/objects/"
到
[FBRequestConnection startWithGraphPath:@"/me/objects/app_namespace:Object_name"