Facebook SDK是否区分iOS调试版本与发布版本

时间:2015-03-20 19:37:24

标签: ios iphone facebook facebook-graph-api permissions

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"
)>}

2 个答案:

答案 0 :(得分:-1)

Nopes Facebook没有区分调试和发布iOS版本。但问题是你无法用于一般用户的心情。要为普通用户登录,您必须在注册申请的https://developers.facebook.com/中无法申请

  1. 首先转到https://developers.facebook.com/并使用您的开发者帐户登录
  2. 点击我的应用程序,然后选择您已注册的应用程序enter image description here
  3. 3.点击设置选项并在联系电子邮件选项中输入您的电子邮件并保存更改enter image description here 4.点击状态&amp;审核并将其设为是enter image description here

    1. 您将看到以下对话点击确认enter image description here

    2. 现在您可以使用任何facebook帐户登录

答案 1 :(得分:-1)

SDK不区分构建配置。您的应用是否已通过登录视图:https://developers.facebook.com/docs/apps/review/login