Note that there are some explanatory texts on larger screens.

plurals
  1. POExpected callback behavior: Signed out of facebook app and Cancel on authentication page
    text
    copied!<p>I am integrating the Facebook SDK 3.0 into our iOS 5.x app, for the purpose of the user being able to post to their timeline about something they've seen in our app.<br> I have it working in the main use case, but I have a couple of scenarios that don't work the way I would like them to.</p> <p><strong>Case #1. User has Facebook app installed on the phone but they are signed out</strong></p> <p>In this case, our app detects that FBSession.activeSession.isOpen is NO (or FALSE). At this point in time here are the details of FBSession.activeSession:</p> <pre><code>&lt;FBSession: 0x4e7ea0, state: FBSessionStateCreated, loginHandler: 0x0, appID: 470875439589287, urlSchemeSuffix: , tokenCachingStrategy:&lt;FBSessionTokenCachingStrategy: 0x48d100&gt;, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:()&gt; </code></pre> <p>Our app makes a call to the appDelegate:</p> <pre><code>[appDelegate openSessionWithAllowLoginUI:YES]; </code></pre> <p>Here is the code for that method:</p> <pre><code>- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI { NSArray *permissions = [[NSArray alloc] initWithObjects: @"publish_actions", nil]; NSLog(@"openSessionWithAllowLoginUI, permissions: %@,allowLoginUI: %c", permissions, allowLoginUI); return [FBSession openActiveSessionWithPermissions:permissions allowLoginUI:allowLoginUI completionHandler:^(FBSession *session, FBSessionState state, NSError *error) { [self sessionStateChanged:session state:state error:error]; NSLog(@"openSessionWithAllowLoginUI, completionHandler for openActiveSessionWithPermissions. session: %@, state: %u, error: %@",session, state, error); }]; </code></pre> <p>}</p> <p>Because the user is not logged into the Facebook app, they don't get an auth screen about my app. Instead they get a login screen for the Facebook app. Once they login to the Facebook app, they're now in Facebook and that's it. No auth screen comes up for my app and they are no longer in my app. Now they potentially get distracted by what Suzy said about Jimmy and don't get back to my app. Sigh...</p> <p>If they remember about my app, and fast app switch to it (or tap the icon), my app detects that the state was FBSessionStateCreatedOpening. I handle this case and get them programmatically back to an auth screen. Now we're back on track.</p> <p>Is there a way to get Facebook to present the auth screen after the user logs into a signed out Facebook account, and from there get them back into my app "automatically"?</p> <p><strong>Case #2 User presses Cancel on auth screen</strong></p> <p>When the user presses Cancel on the auth screen, they are left in the Facebook app. Only way back to our app is to fast app switch or tap our app's icon. However, if they press the Login button on the auth screen, everything is fine. They're in our app, ready to post to Facebook. </p> <p>Programmatically on my end same things are happening as in Case #1. </p> <p>Anyway to handle that Cancel scenario differently, such that I can cancel the user's post to Facebook, but they're still in our app?</p> <p><strong>EDIT #1</strong>: I uninstalled the Facebook app from my iPhone and tested. Both scenarios work the way I want them to, when using Facebook via web browser. So this looks like a different behavior between the Facebook iOS app and the Facebook mobile web page/app.</p> <p>Thanks in advance!</p> <p>Del</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload