IOS-Facebook Blank white screen after app is authorized


I am upgrading from Parse v1.6.4 to the latest version and also i am upgrading facebook ios sdk to v4.7. The problem is after the app is authorized,it shows a blank white screen and if i click "done",it closes the safari and in the log it shows that,user cancelled login.
It was working fine before upgrading it to the 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>

white listing FB server

<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's an image of the screen.

enter image description here

I am running this test app in my IPhone 6 device.
Thank you! :)

Edit 1:
Today,i upgraded my project to Facebook's new v4.8 SDk and this time,it seems like it's working.
I am not sure,what i was doing wrong at that time but it's working now for arm64 devices.
But when i enable support for armv7s,it's giving me this error...

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

It points to FBSDKLoginKit.framework.
Are armv7s devices not supported anymore?
Is there anyway to get rid of this error?
Thank you! :)


Answers:


I had the same problem and it turned out that

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

is deprecated in ios 9.0. I also had implemented the method

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

so FB SDK was calling the latter. So I had to make sure that I call 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 url types beside the facebook ones.