我正试图从我的iOS游戏中发布一个对象。我仔细检查权限,然后复制并粘贴Facebook给我的代码,它不起作用:S
任何想法?
NSMutableDictionary<FBGraphObject> *object =
[FBGraphObject openGraphObjectForPostWithType:@"game:level"
title:@"Sample Level 2"
image:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"
url:@"http://samples.ogp.me/367110273423562"
description:@""];;
object[@"create_object"] = @"1";
object[@"fbsdk:create_object"] = @"1";
[FBRequestConnection startForPostWithGraphPath:@"me/objects/game:level"
graphObject:object
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
// handle the result
NSLog(@"Result: %@",error);
}];
错误回调:
Result: Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1690d1d0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 2500;
message = "Cannot specify type in both the path and query parameter.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0xae21820, state: FBSessionStateOpen, loginHandler: 0xc1279f0, appID: 358605784274011, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xae227a0>, expirationDate: 2013-12-07 05:14:08 +0000, refreshDate: 2013-10-08 14:48:02 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
"basic_info",
installed,
"user_location",
email,
"user_friends",
"user_birthday",
"publish_actions"
)>}
我尝试搜索解决方案,但我在iOS上找不到它
由于
答案 0 :(得分:3)
您收到错误Cannot specify type in both the path and query parameter
,因为object
和graphPath
参数都包含对象类型,即game:level
。不要传递@"me/objects/game:level"
,而只需使用@"me"
。
答案 1 :(得分:1)
我遇到了同样的问题,但是通过在应用的打开图形部分创建对象和操作类型来解决它。用于为引用this link创建操作和对象。它有一个发布自定义故事的好例子。如果您已经创建了对象和操作,那么请重新检查命名空间并调用对象上的操作。