ios – Swift:使用Firebase自动登录用户

ios – Swift:使用Firebase自动登录用户,第1张

概述我想自动登录用户,如果他已经签名并且只是前往主视图但代码运行了两次,你可以看到转换而不是刚刚显示的视图.我如何解决它? AppDelegate.swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 我想自动登录用户,如果他已经签名并且只是前往主视图但代码运行了两次,你可以看到转换而不是刚刚显示的视图.我如何解决它?

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}

日志

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 started2016-06-06 01:00:55.666 UnTitled[13009:] <FIRAnalytics/INFO> To enable deBUG logging set the following application argument: -FIRAnalyticsDeBUGEnabled2016-06-06 01:00:55.714 UnTitled[13009:6258910] Firebase Crash Reporting: Successfully enabled2016-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 NO2016-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.02016-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 NO2016-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.pListautomatic Sign In: Optional("mohamed.mohd@hotmail.com")2016-06-06 01:00:56.759: <FIRInstanceID/WARNING> APNS Environment in profile: developmentautomatic Sign In: Optional("mohamed.mohd@hotmail.com")2016-06-06 01:00:57.811 UnTitled[13009:] <FIRAnalytics/INFO> Firebase Analytics enabled
解决方法 尝试:
if let alreadySignedIn = FIRAuth.auth()?.currentUser {    // segue to main vIEw controller} else {    // sign in}
总结

以上是内存溢出为你收集整理的ios – Swift:使用Firebase自动登录用户全部内容,希望文章能够帮你解决ios – Swift:使用Firebase自动登录用户所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1105788.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存