我已在我的应用程序中集成了Firebase Auth,以通过无密码身份验证登录或注册用户。
我已经完成了Firebase文档上的所有设置说明。
我还跟随下面的博客来设置Firebase无密码身份验证。
https://medium.com/@huzaifa.ameen229/firebase-email-link-authentication-ac2504068562
下面是我的sendAuthLink代码,它假设要发送链接以提及邮件ID,但有些消息会在崩溃日志下方崩溃。
代码:
@IBAction func didTapSendSignInLink(_ sender: Any) {
if let email = self.emailField.text {
let actionCodeSettings = ActionCodeSettings.init()
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.url = URL(string: String(format:"https://myapp-4e836.firebaseapp.com/?email=%@",email))
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
Auth.auth().sendSignInLink(toEmail:email,actionCodeSettings: actionCodeSettings) { error in
// ...
if let error = error {
print("error in send link :",error)
//self.showMessagePrompt(error.localizedDescription)
return
}
// The link was successfully sent. Inform the user.
// Save the email locally so you don't need to ask the user for it again
// if they open the link on the same device.
UserDefaults.standard.set(email, forKey: "Email")
//self.showMessagePrompt("Check your email for link")
// ...
}
}
}
崩溃日志:
-[SignUpInVC sendAuthLink:]:无法识别的选择器已发送到实例0x106e0fa30 2019-03-01 11:25:36.700059 + 0530 Marty [12426:2747193] *** 由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'-[SignUpInVC sendAuthLink:]: 无法识别的选择器已发送到实例0x106e0fa30'
如果有人遇到此问题,我不确定是否会错过安装程序中的某些内容。
我从不调用[SignUpInVC sendAuthLink:]
函数,但是它仍然在上面的日志中引发崩溃。
请指导我使其运行而不会崩溃我的应用程序。
谢谢!