我正在尝试使用facebook图形版本方法为IOS获取app_link_hosts,但我收到错误消息。任何人都可以帮我解决这个问题。 Facebook和App Link的文档不明确。
这是代码,
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"app name", @"name",
theUrl, @"al:ios:url",
@"app store id", @"al:ios_id",
@"app name", @"al:ios:app_name",
@"{\"should_fallback\": false}", @"web",
fbAccessToken, @"access_token",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:@"/(fb app id)/app_link_hosts"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(@"Result = %@",result);
if(error) NSLog(@"error = %@",error);
}];
这是我得到的错误,
error = Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x8c7d4b0 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 200;
message = "(#200) Permissions error";
type = OAuthException;
};
};
code = 403;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x9a53750, state: FBSessionStateOpen, loginHandler: 0x9a51fd0, appID: 443803585653119, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x9a52960>, expirationDate: 2014-09-12 10:12:17 +0000, refreshDate: 2014-07-14 12:00:51 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
installed,
"public_profile",
"publish_actions",
"user_friends"
)>}
答案 0 :(得分:0)
我的猜测是你正在使用&#34;用户访问令牌&#34;而不是&#34; app令牌&#34;这是生成应用程序链接所必需的。尝试使用Graph api explorer生成测试链接 - https://developers.facebook.com/tools/explorer/(选择app token选项),因为从客户端设备生成是不好的做法。