Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 492
Goni Avatar asked Jul 06 '13 06:07

Goni


1 Answers

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.

like image 146
Niraj Shah Avatar answered Nov 03 '22 00:11

Niraj Shah