It seems to me that on the first request to open a session, iOS integrated Facebook, and the old "app switching" authorization works differently.
First you need to open a session with read permissions only, and then request publication permission at the time of publication.
The old one needs to be requested for each permission for the first time, so the application will be able to send later (otherwise not).
So, I shared the session opening logic in my facebook connection method:
-(void)connectWithSuccess:(EPPZSuccessBlock) successBlock fail:(EPPZFailBlock) failBlock { if (FBSession.activeSession.isOpen) { if (successBlock) successBlock(); [self socialServiceDidConnect:self]; } else { //This is what I need to decide somehow. BOOL userHaveIntegrataedFacebookAccountSetup = NO; if (userHaveIntegrataedFacebookAccountSetup) { //Request for a session with read permissions only, otherwise iOS integrated Facebook will throw me an exception. [FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObject:@"user_about_me"] allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { [self handleOpenSessionResponseWithSession:session status:status error:error success:successBlock fail:failBlock]; }]; } else { //Request for session with every (incuding publish) permissions, otherwise non integrated Facebook won't let the app to post later. [FBSession openActiveSessionWithPublishPermissions:self.publishPermissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { [self handleOpenSessionResponseWithSession:session status:status error:error success:successBlock fail:failBlock]; }]; } } }
But I need some simple definition of which one to use, so the question is: how to determine if the user has an integrated Facebook account for the iOS account before the request session?
source share