2
votes

I'm using iOS SDK 3.1.1 and trying to get both read and publish permission at once. As tutorial says, I'm calling FBSession openActiveSessionWithReadPermissions and in its handler - handler A - call [[FBSession activeSession] reauthorizeWithPublishPermissions only if handler A is called with session state of FBSessionStateOpen.

When I have facebook account is set in iOS 6's setting, reauthorizeWithPublishPermissions's handler - handler B - is called normally, with error argument of nil.

However, if I don't have facebook account set in iOS 6's setting, handler B is called with reauth error named "ErrorReauthorizeFailedReasonUserCancelled" when app is switched to Safari to gain publish permission.

More weird thing is this. In both cases before handler B is called, handler A is called with session state of FBSessionStateOpenTokenExtended.

Are these normal or expected behavior of new SDK? If so, should I not check if error is nil in handler B?

1
developers.facebook.com/bugs/… reported it to facebook's bugs tracking system - minorblend
happens to me too, have you figured out a workaround? - marchinram

1 Answers

0
votes

happened to me and after searching a while I found a solution for that. You have to call reauthorizeWithPublishPermissions in dispatch_async in the handler A of openActiveSessionWithReadPermissions:

dispatch_async(dispatch_get_current_queue(), ^{
    [[FBSession activeSession] reauthorizeWithPublishPermissions:permissions
                                                 defaultAudience:FBSessionDefaultAudienceEveryone
                                               completionHandler:^(FBSession *session, NSError *error) {
                                                   // handle the flow here
                                           }];
});