【发布时间】:2015-05-24 08:04:49
【问题描述】:
Facebook 是否区分调试和发布 iOS 版本?在向 iTunes 提交新版本之前,我正在测试我的应用程序。我的应用程序使用在 Facebook 上发布照片的单一权限(即 publish_actions)。奇怪的是,当我使用我的 Facebook 帐户进行测试时,一切正常。但是当我用伙伴的Facebook账号测试时,却没有通过:开发者账号链接到我的Facebook账号;不是我伴侣的。基本上针对以下方法
// Convenience method to perform some action that requires the "publish_actions" permissions.
- (void)performPublishAction:(void(^)(void))action {
// we defer request for permission to post to the moment of post, then we check for the permission
if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {
// if we don't already have the permission, then we request it now
NSLog(@"Requesting publish permission");
[FBSession.activeSession requestNewPublishPermissions:@[@"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
NSLog(@"Completion handler returns for permission");
NSLog(@"My Permissions are: %@",session.permissions);
if (!error) {
NSLog(@"Okay no error");
action();
} else if (error.fberrorCategory != FBErrorCategoryUserCancelled) { NSLog(@"ERROR GETTING PERMISSION:: %@",error);
}
}];
} else {
NSLog(@"the other route");
action();
}
}
action() 永远不会被调用。
线
NSLog(@"My Permissions are: %@",session.permissions);
打印
My Permissions are: (
"public_profile"
)
还有那行
NSLog(@"The ERROR IS: %@",error);
打印
The ERROR IS: Error Domain=com.facebook.sdk Code=2
"The operation couldn’t be completed. com.facebook.sdk:ErrorReauthorizeFailedReasonUserCancelled" UserInfo=0x1702779c0
{com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:ErrorReauthorizeFailedReasonUserCancelled,
NSLocalizedFailureReason=com.facebook.sdk:ErrorReauthorizeFailedReasonUserCancelled,
com.facebook.sdk:ErrorSessionKey=<FBSession: 0x170169480, state: FBSessionStateOpen, loginHandler:
0x100374240, appID: 123456789, urlSchemeSuffix: ,
tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x17022a740>, expirationDate: 2015-05-19 19:07:02 +0000,
refreshDate: 2015-03-20 19:07:02 +0000, attemptedRefreshDate: 0000-12-30 00:00:00 +0000, permissions:(
"public_profile"
)>}
【问题讨论】:
-
基本上——至少在我看来——我合作伙伴的 Facebook 帐户无法从 Facebook SDK 读取 publish_actions 权限。另外,我的搭档已经允许 Instagram 发帖。但不知何故,我们自己的应用程序没有获得他帐户的许可。
-
问题解决了吗
-
我投了赞成票,希望也能在我的回答中得到它
标签: ios iphone facebook facebook-graph-api permissions