简体   繁体   中英

Facebook iOS SDK: How to handle SKIP button when requesting publish_actions?

I have a code to login to Facebook with 'publish_actions' permission. Here's the snippet:

NSArray *facebookPermissions = [NSArray arrayWithObjects:@"publish_actions", nil];

[FBSession openActiveSessionWithPublishPermissions:[self facebookPermissions]
                                   defaultAudience:FBSessionDefaultAudienceFriends
                                      allowLoginUI:YES
                                 completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
    NSLog(@">>> Permissions available: %@", FBSession.activeSession.permissions);
}];

When that method is executed, user will be redirected to Mobile Safari Facebook page and asked whether facebook is allowed to access his/her account.

Screen1:

APPNAME would like to access your public profile and friend list.
[CANCEL] [OK]

After pressing OK, since we use the openActiveSessionWithPublishPermissions method, a second page will appear asking if facebook is allowed to publish stuff on your behalf.

Screen 2:

APPNAME would like to post to your friends on your behalf.
[AUDIENCE] [SKIP] [OK]

The tricky part is, when user clicks SKIP button, the log in the callback still list 'publish_actions' as one of the available permissions. Which is incorrect. The error is also nil. How do I detect this properly?

This is the log:

2013-07-06 16:35:59.037 FbSandbox[56213:c07] >>> Permissions available: ("publish_actions")

Thanks in advance!

You can validate the accepted permissions by calling me/permissions . This will list the permissions the user has allowed. Cross-reference this list with the permissions you ask for and you'll be able to find out which were accepted and which were skipped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM