Second Update
After doing some more digging, there seems to be a bigger issue at play.
The reason why openURL is not fired, is that the app seems to be freezing when it is brought back to the foreground.
If I launch my app, click the home button (go back to home screen), and re-load my app (not full relaunch but just a restore), the app opens, but everything is frozen.
-(void)applicationWillEnterForeground:(UIApplication *)application
is fired when the app comes back, however after that nothing happens. Using the simulator for IOS 6.0 I get no crash at all, but the app just sits there doing nothing. Click on the screen does nothing. If I click on the home screen I can go back to the home screen.
So the reason openIURL is not fired is because the app freezes when it comes back from Facebook login either from Safari or Facebook app. It has nothing to do with the facebook SDK.
Why is this happening?
Update Seems the issue is related with openURL not being called. The app does open when the custom URL is executed from safari or facebook app. If I create a brand new app it does work.
Another Related Issue application open Url method not called after user authenticates the facebook
I have an app that uses facebook login with the facebook SDK 3.0.
Under IOS 5 the flow works as intended and I do see the output of IS LOGGED IN:
NSArray *permissions = [[NSArray alloc] initWithObjects: @"publish_stream",@"offline_access",@"email",nil];
[FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
if(session.isOpen){
NSLog(@"IS LOGGED IN");
}
}];
[permissions release];
In my App delegate the openURL function is as follows
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [[FBSession activeSession] handleOpenURL:url];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [[FBSession activeSession] handleOpenURL:url];
}
Again, under IOS 5 the openURL function is called after a successful login through facebook.
Under IOS 6, when I execute the openActiveSessionWithPermission (login)..the openURL is never called back.
I have supplied the necessary information in my .plist file according to facebook documentation
FacebookAppID = (My Facebook App ID)
and
URL types
-> Item 0
-> URL Schemes
-> Item 0 = (My Facebook App ID)
The issue was related to the way I was using TWTweetComposeViewController in my app, so it is not related to facebook SDK afterall.
The issue was that I was initializing my TWTweetComposeViewController in my ViewDidLoad and not using until needed. However, if the TWTweetComposeViewController is not shown but is initiliazed, it will freeze your application when it enters from background mode.
The fix is to initiliaze TWTweetComposeViewController only when you are about to show it.