Firebase推送通知 - XCode 8.0 / Swift 3.0 / ios 10.0

时间:2016-11-16 09:52:29

标签: firebase swift3 ios10 firebase-cloud-messaging firebase-notifications

我使用Firebase进行推送通知。

didRegisterForRemoteNotificationsWithDeviceToken中,我有以下行:

FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.prod)

我收到以下错误消息:

  

无法转换类型'数据'的值预期参数类型'数据'。

1 个答案:

答案 0 :(得分:0)

将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) 
 }