Firebase:在Xcode中没有获取onAuthStateChanged()方法?

问题描述 投票:0回答:1

我需要在我正在开发的应用程序的登录过程中使用Firebase身份验证中的onAuthStateChanged()方法,并尝试使用它,就像我在网上的每个来源中看到的那样:

firebase.auth().onAuthStateChanged()

但是,这会返回错误:

Use of unresolved identifier 'firebase'

我导入Firebase身份验证错误或者此方法是否已在Firebase的最新更新中更改?这些是我在文件中的导入:

import UIKit
import Firebase
import FirebaseDatabaseUI
import FirebaseAuthUI

这是我的pods文件:

platform :ios, '9.0'

target 'MyProject' do
  use_frameworks!
  pod 'Firebase'
  pod 'Firebase/Core'
  pod 'Firebase/Storage'
  pod 'Firebase/Database'
  pod 'FirebaseUI'
  pod 'TwitterCore', '<=3.0.0' 
  pod 'Firebase/Auth'
end

任何提示将不胜感激!谢谢! :)

ios xcode firebase firebase-authentication cocoapods
1个回答
0
投票

虽然JavaScript Firebase API包含onAuthStateChanged,但Swift API却没有。

对于斯威夫特看,addAuthStateDidChangeListener:。文件here

© www.soinside.com 2019 - 2024. All rights reserved.