2016-06-17 9 views
4

zeigt Ich bin mit FBSDKCoreKit (4.12.0) FBSDKLoginKit (4.12.0) ersten ich bin immer Bildschirm 1Facebook-Login-Seite leere Seite in IOS 9

Diese Methode ist Block nie aufgerufen wird.

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

immer diese Warnung

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

enter image description here

Dann drücke ich OK-Taste i leere Seite bin immer ohne

zu einer anderen Seite zu bewegen

enter image description here

Plist-Datei i verwendet wird

Für Transpost Sicherheit

<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> 
+0

Haben Sie dieses Problem gelöst? –

+0

@marco Grieco: ja gelöst – MuraliMohan

Antwort

6

Wie ich Lösung für das obige Problem gefunden ist

1) Früher i eine Schaltfläche erstellt haben und FBLoginButton Klasse gegeben und in Aktion i schrieb wie

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

Modifikation für Lösung: Entfernte die FBLoginButton-Klasse und setzen Sie nur UIButton

2) Verwenden Sie beide iOS 8 und iOS 9 Methoden wie unten in AppDelegate geschrieben.

- (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 
      ]; 
} 
+0

Ich kann nicht scheinen, zwei Methoden in appdelegate hinzufügen, Doppelter Deklarationsfehler erscheint –

+0

Gleiches Problem kommend bro "Doppelte Erklärung" Wie hat es für Sie funktioniert? Ich kopierte und klebte nur –

+0

@SuperXtreem zweiten enthält "Annotation" Schlüsselwort, aber zuerst enthält dann nicht, wie können Sie doppelt erhalten? – MuraliMohan

0

Ich habe Code verwendet in Fabook, funktionieren beide gut auf iOS 8 und 9. Hoffnung, dies hilft Ihnen zu unterzeichnen.

[[[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 
     } 
    }];