Facebook login page showing blank page in iOS 9

I use FBSDKCoreKit (4.12.0) FBSDKLoginKit (4.12.0) first I get screen 1

This blocked method is never called.

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email",@"public_profile"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    //never called
}];

receiving this warning

 Warning: Attempt to present <FBSDKContainerViewController: 0x16570810> on <ViewController: 0x16528870> whose view is not in the window hierarchy!

enter image description here

Then I click ok. I get a blank page without going to another page.

enter image description here

The plist file I used is

For security Transpost

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

Query schems


    <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>fbauth</string>
            <string>fbapi</string>
            <string>fb-messenger-api</string>
            <string>fbauth2</string>
            <string>fbshareextension</string>
            <string>fbapi20130214</string>
            <string>fbapi20130410</string>
            <string>fbapi20130702</string>
            <string>fbapi20131010</string>
            <string>fbapi20131219</string>
            <string>fbapi20131219</string>
            <string>fbapi20140410</string>
            <string>fbapi20140116</string>
            <string>fbapi20150313</string>
            <string>fbapi20150629</string>
            <string>fb-messenger-api20140430</string>
        </array>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>fb268237443567174</string>
                </array>
            </dict>
        </array>
        <key>FacebookAppID</key>
        <string>268237443567174</string>
        <key>FacebookDisplayName</key>
        <string>MyAPP</string>
+4
source share
2 answers

As I found a solution for the indicated problem:

1) Previously, I created a button and gave the FBLoginButton class, and in action I wrote as

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email",@"public_profile"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    //never called
}];

Modification of the solution: Removed the FBLoginButton class and placed only UIButton

2) Use the ios 8 and ios 9 methods as described below in AppDelegate.

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                          openURL:url
                                                sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                       annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{

    return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                          openURL:url
                                                sourceApplication:sourceApplication
                                                       annotation:annotation
            ];
}
+6

Fabook, iOS 8 9. , .

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"email,name,first_name,last_name"}] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        if (!error) {
           //Login success and callback here
        } else {
           //Login failed
        }
    }];
0

All Articles