Sab*_*bah 1 ios firebase appdelegate firebase-authentication swift3
我正在使用电话号码在iOS上集成Authenticate和Firebase,并且我在此链接的文档中提到的过程的初始实现中存在错误.
我按照他们提到的程序,安装了pods并导入了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
// ...
}
Run Code Online (Sandbox Code Playgroud)
和
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.
}
Run Code Online (Sandbox Code Playgroud)
它说" 使用未解析的标识符'AuthAPNSTokenTypeProd' "和" 使用未解析的标识符'UIBackgroundFetchResultNoData' ".
我不确定我在实施中缺少的程序.我已多次执行实施程序,我找不到错误.
请尝试以下代码
Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenType.prod)
Run Code Online (Sandbox Code Playgroud)
还有这个
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.
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
625 次 |
最近记录: |