I found a solution, but you have to change something in the FBSDKLogin module. I was debugging Pod, and I realized that Facebook is asking in the FBSDKServerConfiguration class to configure the server for the application. It returns JSON with some information to configure Pod for our application. I realized that by default JSON returns this dictionary:
"ios_sdk_dialog_flows" = { default = { "use_native_flow" = 0; "use_safari_vc" = 1; }; message = { "use_native_flow" = 1; }; };
By default, use_native_flow is 0, so when it saves information in userDefaults to launch the next application. So, when the application calls the FBSDKLoginMananger login method and checks the loginBehaviour in this method, the useNativeDialog variable returns NO. Thus, the switch uses the following case. case FBSDKLoginBehaviorBrowser:
- (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior { . . ... switch (loginBehavior) { case FBSDKLoginBehaviorNative: { if ([FBSDKInternalUtility isFacebookAppInstalled]) { [FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) { BOOL useNativeDialog = [serverConfiguration useNativeDialogForDialogName:FBSDKDialogConfigurationNameLogin]; if (useNativeDialog && loadError == nil) { [self performNativeLogInWithParameters:loginParams handler:^(BOOL openedURL, NSError *openedURLError) { if (openedURLError) { [FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors formatString:@"FBSDKLoginBehaviorNative failed : %@\nTrying FBSDKLoginBehaviorBrowser", openedURLError]; } if (openedURL) { completion(YES, FBSDKLoginManagerLoggerAuthMethod_Native, openedURLError); } else { [self logInWithBehavior:FBSDKLoginBehaviorBrowser]; } }]; } else { [self logInWithBehavior:FBSDKLoginBehaviorBrowser]; } }]; break; }
As we see in the code, we know if the application is installed in this case, if, if ([FBSDKInternalUtility isFacebookAppInstalled]) . To solve the problem, I changed this line
BOOL useNativeDialog = [serverConfiguration useNativeDialogForDialogName:FBSDKDialogConfigurationNameLogin];
to
BOOL useNativeDialog = YES;
I know that this is not a good practice, and that will change if I update this Pod, but at least it works, and I need it now. I think we can change this configuration on the facebook developer admin site, but I did not find anything.