Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook SDK - iOS6 login popup cannot be dismissed

In my iPhone app, I want the user to be able to share a link on Facebook.

When they click "share", I use the following code to login to Facebook using the new SDK 3.1, then use FBRequestConnection in the completion handler (a simple publish_action).

[FBSession openActiveSessionWithPublishPermissions:@[@"publish_actions"] defaultAudience:FBSessionDefaultAudienceFriends allowLoginUI:true completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {

    // Now call FBRequestConnection to post in the stream

}];

When the user has the Facebook app installed, it just delegates the login to the app. However when they don't, it opens the login page in a WebView.

In iOS 5, it opens Mobile Safari:

enter image description here

My problem is on iOS 6, I get the same flow but in a modal popup instead (on top of my app).

enter image description here

I have 2 issues with the popup:

1. Closing it

It cannot be cancelled or dismissed. In comparison, the HelloFacebookSample app from the SDK has the same popup but with a cross button to close it.

enter image description here

NOTE: now solved thanks to ravi, I was missing the Facebook resource bundle which contains the "close" image.

2. Accepting the permissions

On the second step of the popup (see screens above), pressing Okay doesn't do anything. Pressing the "X" calls the completion handler with an error, which is great, but nothing happens with Okay. Is this the right way to login to Facebook with the SDK 3.1? Am I missing a callback to react to the popup specifically?

Some more clarifications:

This only happens in iOS6 when the Facebook app is not installed and the Facebook account is not configured in the iOS settings.

Thanks!

like image 301
Romain Avatar asked Oct 07 '12 22:10

Romain


1 Answers

I can't comment as my reputation is less than 50, so trying to point out my observations as answer.

I too noticed this problem when using Facebook sdk3.1 on ios6. In my case I'm using the old style facebook object creation and call [facebook authorize:permissions] on it, but I modified the source code to always use "FBSessionLoginBehaviorForcingWebView" so that my login is always through in-app web login.

In my case I was missing FBUserSettingsViewResources.bundle and FacebookSDKResources.bundle, so I was unable to see the cross button (but I was able to tap on that spot and getting call back - (void)fbDidNotLogin:(BOOL)cancelled {) .

like image 194
ravi Avatar answered Oct 24 '22 00:10

ravi