Firebase-iOS应用程序上设备上的令牌无效

Firebase-iOS应用程序上设备上的令牌无效,ios,firebase,Ios,Firebase,我尝试在iOS应用程序中实现firebase。 我无法在我的设备上进行推送 对于调试,我尝试使用curl请求: 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!

我尝试在iOS应用程序中实现firebase。 我无法在我的设备上进行推送

对于调试,我尝试使用curl请求:

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>"}'
curl——标题“内容类型:应用程序/json”\
--标题“授权:密钥=”\
https://fcm.googleapis.com/fcm/send \
-d'{“通知”:{“正文”:“通过FCM从curl向您问好!”,“声音”:“默认”},
“优先级”:“高”,
“至”:“}”
若我尝试使用我得到的令牌,在实际设备上启动应用程序时,我得到以下信息:错误:“InvalidRegistration”

若我使用来自Android同事的令牌(甚至是我从模拟器设备上的启动应用程序中获得的令牌),我会成功并得到类似消息id的响应


如何解决此问题?

您的有效负载似乎不正确,请尝试在终端中执行以下命令,并根据您的要求进行调整:

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"
curl-X POST-H“Authorization:key=“-H”内容类型:application/json“-d”{
“数据”:{
“标题”:“通知标题”,
“正文”:{
“名称”:“正文文本”,
}
},
“至”:”
}' "https://fcm.googleapis.com/fcm/send"