Swift: Auto-Login-Benutzer mit FB

Möchte ich das auto-login des Benutzers, wenn er bereits signiert ist und nur das Haupt-anzeigen, aber der code ausgeführt wird, zweimal, und Sie können sehen, der Umstieg statt den Blick nur zu zeigen. Wie kann ich es beheben?

AppDelegate.swift

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    //Override point for customization after application launch.slideMenuController
    FIRApp.configure()
    FIRAuth.auth()?.addAuthStateDidChangeListener {
        auth, user in
        if user != nil {
            //User is signed in.
            print("Automatic Sign In: \(user?.email)")

            let storyboard = UIStoryboard(name: "Main", bundle: nil)
            let initialViewController = storyboard.instantiateViewControllerWithIdentifier("EmployeeRevealViewController")
            self.window!.rootViewController = initialViewController

        } else {
            //No user is signed in.
        }
    }

    return true
}

Log

2016-06-06 01:00:55.585 Untitled[13009:6258910] Configuring the default app.
2016-06-06 01:00:55.657 Untitled[13009:] <FIRAnalytics/INFO> Firebase Analytics v.3200000 started
2016-06-06 01:00:55.666 Untitled[13009:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2016-06-06 01:00:55.714 Untitled[13009:6258910] Firebase Crash Reporting: Successfully enabled
2016-06-06 01:00:55.739: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-06-06 01:00:55.739: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2016-06-06 01:00:55.760: <FIRMessaging/INFO> FIRMessaging library version 1.1.0
2016-06-06 01:00:55.781: <FIRMessaging/WARNING> FIRMessaging AppDelegate proxy enabled, will swizzle app delegate remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-06-06 01:00:55.788 Untitled[13009:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
Automatic Sign In: Optional("[email protected]")
2016-06-06 01:00:56.759: <FIRInstanceID/WARNING> APNS Environment in profile: development
Automatic Sign In: Optional("[email protected]")
2016-06-06 01:00:57.811 Untitled[13009:] <FIRAnalytics/INFO> Firebase Analytics enabled
  • haben Sie sich die auth-Daten ?
  • Folgen Sie dieser doc aus FB: firebase.google.com/docs/auth/ios/...
  • Ich habe verfolgt, dass der doc. Es funktioniert, aber der code läuft einfach zweimal wie Sie sehen können am Ende des Protokolls. Und dann gibt es einen übergang aus dem home-Bildschirm zum Hauptmenü zu gelangen
  • Sind Sie sicher, dass Sie nicht etwas zu tun auth Verwandte in den anderen VC ' s? Was ist der übergang von der home-Bildschirm auf dem Haupt-Bildschirm genau?
Schreibe einen Kommentar