试图复制这个新的教程:https://codelabs.developers.google.com/codelabs/firebase-ios-swift/index.html?index=..%2F..%2Findex#0
现在突然间我得到错误使用未解决的标识符’FIRAuth’在我的VC.
我已经尝试重新安装pods文件,没有任何运气,似乎有时如果它添加“导入Firebase”,然后删除它的应用程序将编译,似乎没有韵律或理由为什么它有时工作其他时候没有:
这是我的代码:
import UIKitimport FirebaseAuthclass SignInVIEwController: UIVIEwController {@IBOutlet weak var emailFIEld: UITextFIEld!@IBOutlet weak var passwordFIEld: UITextFIEld!overrIDe func vIEwDIDAppear(animated: Bool) { if let user = FIRAuth.auth()?.currentUser { //error here self.signedIn(user) }}@IBAction func dIDTapSignIn(sender: AnyObject) { // Sign In with credentials. let email = emailFIEld.text let password = passwordFIEld.text FIRAuth.auth()?.signInWithEmail(email!,password: password!) { //error here (user,error) in if let error = error { print(error.localizedDescription) return } self.signedIn(user!) }}@IBAction func dIDTapSignUp(sender: AnyObject) { let email = emailFIEld.text let password = passwordFIEld.text FIRAuth.auth()?.createuserWithEmail(email!,password: password!) { // error here(user,error) in if let error = error { print(error.localizedDescription) return } self.setdisplayname(user!) }}func setdisplayname(user: FIRUser) { let changeRequest = user.profileChangeRequest() changeRequest.displayname = user.email!.componentsSeparatedByString("@")[0] changeRequest.commitChangesWithCompletion(){ (error) in if let error = error { print(error.localizedDescription) return } self.signedIn(FIRAuth.auth()?.currentUser) //error here }}@IBAction func dIDRequestPasswordreset(sender: AnyObject) { let prompt = UIAlertController.init(Title: nil,message: "Email:",preferredStyle: UIAlertControllerStyle.Alert) let okAction = UIAlertAction.init(Title: "OK",style: UIAlertActionStyle.Default) { (action) in let userinput = prompt.textFIElds![0].text if (userinput!.isEmpty) { return } FIRAuth.auth()?.sendPasswordresetWithEmail(userinput!) { //error here (error) in if let error = error { print(error.localizedDescription) return } } } prompt.addTextFIElDWithConfigurationHandler(nil) prompt.addAction(okAction) presentVIEwController(prompt,animated: true,completion: nil);}func signedIn(user: FIRUser?) { MeasurementHelper.sendLoginEvent() AppState.sharedInstance.displayname = user?.displayname ?? user?.email AppState.sharedInstance.photoUrl = user?.photoURL AppState.sharedInstance.signedIn = true NSNotificationCenter.defaultCenter().postNotificationname(Constants.NotificationKeys.SignedIn,object: nil,userInfo: nil) // performSegueWithIDentifIEr(Constants.Segues.SignInToFp,sender: nil)}}
有没有人知道为什么会发生这种情况?
解决方法 对于未来的读者:确保在您的Podfile中包含以下内容:
pod’Firebase / Auth’
安装pod后,请使用:
导入FirebaseAuth
这是为我解决的.
总结以上是内存溢出为你收集整理的ios – 使用未解析的标识符“FIRAuth”(Swift 2,Firebase 3.x)全部内容,希望文章能够帮你解决ios – 使用未解析的标识符“FIRAuth”(Swift 2,Firebase 3.x)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)