我正在使用电话号码在 iOS 上将 Authenticate 与 Firebase 集成,并且在此 link. 中的文档中提到的过程的初始实现中出现错误
我按照他们提到的程序安装了 pod 并导入了 firebase SDK。
错误来自以下两种方法:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// Pass device token to auth
Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenTypeProd)
// Further handling of the device token if needed by the app
// ...
}
和
func application(_ application: UIApplication,
didReceiveRemoteNotification notification: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if Auth.auth().canHandleNotification(notification) {
completionHandler(UIBackgroundFetchResultNoData)
return
}
// This notification is not auth related, developer should handle it.
}
它说“ 使用未解析的标识符 'AuthAPNSTokenTypeProd' ”和“ 使用未解析的标识符 'UIBackgroundFetchResultNoData' ”。
我不确定我在实现中缺少的程序。执行过程我经历了很多次,我找不到错误。
最佳答案
请尝试以下代码
Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenType.prod)
还有这个
func application(_ application: UIApplication,
didReceiveRemoteNotification notification: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if Auth.auth().canHandleNotification(notification) {
completionHandler(UIBackgroundFetchResult.noData)
return
}
// This notification is not auth related, developer should handle it.
}
关于ios - Firebase 使用电话号码 : use of unresolved identifier AuthAPNSTokenTypeProd and UIBackgroundFetchResultNoData error 进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44352917/