IOS-Facebook Blank white screen after the application is authorized

I am updating from Parse v1.6.4 to the latest version, as well as updating iOS sdk facebook to version 4.7. The problem is that the application is allowed, it shows a blank white screen, and if I click "done", it closes the safari, and in the log it shows that the user has canceled the login.
It worked great before upgrading it to a new version.

my plist

<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fbxxxxxx</string> </array> </dict> </array> <key>FacebookAppID</key> <string><my FacebookAppID></string> <key>FacebookDisplayName</key> <string>my appname</string> 

FB server whitelist

 <key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>facebook.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>fbcdn.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>akamaihd.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSExceptionRequiresForwardSecrecy</key> <false/> </dict> 

 <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array> 

AppDelegate.m

 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; } - (void)applicationDidBecomeActive:(UIApplication *)application { [FBSDKAppEvents activateApp]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; } 

viewController.m

 -(IBAction)facebookLogin:(id)sender { FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; if ([FBSDKAccessToken currentAccessToken]) { //Do something } else { [login logInWithReadPermissions:@[@"email"] fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if (error) { NSLog(@"Error"); } else if (result.isCancelled) { NSLog(@"User cancelled login"); } else { NSLog(@"Login Success"); if ([result.grantedPermissions containsObject:@"email"]) { NSLog(@"result is:%@",result); } else { NSLog(@"FB email permission error"); } } }]; } } 

Here is the screen image.

enter image description here

I am running this test application on my iPhone 6 device.
Thanks!:)

Change 1:
Today I upgraded my project to the new v4.8 SDK for Facebook, and this time it seems to work.
I'm not sure what I was doing wrong at the time, but now it works for arm64 devices.
But when I turn on armv7s support, it gives me this error ...

 ld: file is universal (4 slices) but does not contain a(n) armv7s slice: 

It points to FBSDKLoginKit.framework.
Armv7s devices no longer supported?
Is there any way to get rid of this error?
Thanks!:)

+5
source share
1 answer

I had the same problem and it turned out that

 func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool 

deprecated in ios 9.0. I also implemented a method

 func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool 

therefore, the FB SDK invoked the latter. So I had to make sure that I called FBSDKApplicationDelegate in both methods (once for ios 8 and once for ios9).

Here is my implementation of AppDelegate:

  @available(iOS 9.0, *) func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { let handled = FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options [UIApplicationOpenURLOptionsAnnotationKey]) if !handled { return self.openURL(url) } return true } @available(iOS, introduced=8.0, deprecated=9.0) func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { let handled = FBSDKApplicationDelegate.sharedInstance() .application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) if !handled { return self.openURL(url) } return true } 

where self.openURL (url) can be used to handle other types of URLs next to facebook.

+3
source

Source: https://habr.com/ru/post/1235121/


All Articles