2017-09-18 68 views
0

我尝试在iOS应用中实施Firebase。 我无法推动我的设备。Firebase - iOS设备上设备上的无效令牌

调试我试图用卷曲的要求:如果我试图令牌,我得到使用

curl --header "Content-Type: application/json" \ 
--header "Authorization: key=<my key here>" \ 
https://fcm.googleapis.com/fcm/send \ 
-d '{"notification": {"body": "Hello from curl via FCM!", "sound": "default"}, 
"priority": "high", 
"to": "<my token here>"}' 

,在我得到了以下真实设备启动应用程序:错误:“InvalidRegistration”

如果我使用来自我的Android同事的令牌(或者甚至是我从模拟器设备上的启动应用获得的令牌)我成功并获得了类似于消息ID的响应。

如何解决这个问题?

回答

0

你的负载似乎是不正确的,在终端尝试下面的命令,并将其调整按您的要求:

curl -X POST -H "Authorization: key=<my key here>" -H "Content-Type: application/json" -d '{ 
    " data ": { 
    "title": "Notification title", 
    " body ": { 
"name": "Body text", 
} 
    }, 
    "to": "<my token here>" 
}' "https://fcm.googleapis.com/fcm/send"