Firebase推送通知 - XCode 8.0/Swift 3.0/ios 10.0
问题描述:
我正在使用Firebase推送通知。Firebase推送通知 - XCode 8.0/Swift 3.0/ios 10.0
在didRegisterForRemoteNotificationsWithDeviceToken
,我有以下行:
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.prod)
我收到以下错误信息:
无法将类型的值“数据”预期参数类型“数据”。
答
更新您的火力地堡的SDK 4.0.0 和添加以下代码:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
let firebaseAuth = Auth.auth()
// .sandbox is used during development, later on it can be changed to .prod
firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.sandbox)
}