【问题标题】:Firebase Push Notification - XCode 8.0 / Swift 3.0/ ios 10.0Firebase 推送通知 - XCode 8.0 / Swift 3.0/ ios 10.0
【发布时间】:2017-03-30 11:02:37
【问题描述】:
我正在使用 Firebase 进行推送通知。
在didRegisterForRemoteNotificationsWithDeviceToken,我有以下行:
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.prod)
我收到以下错误消息:
无法将“数据”类型的值转换为预期的参数类型“数据”。
【问题讨论】:
标签:
firebase
swift3
ios10
firebase-cloud-messaging
firebase-notifications
【解决方案1】:
将您的 Firebase 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)
}