简体   繁体   English

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

[英]Firebase - invalid token on device on iOS app

I try to implement firebase in my iOS app. 我尝试在我的iOS应用中实现Firebase。 I can't get pushes on my device. 我无法在设备上进行推送。

For debug I tried to use curl request: 对于调试,我尝试使用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>"}'

If I try to use token that I get, launching app on real device I got following: error:"InvalidRegistration" 如果我尝试使用获得的令牌,则在真实设备上启动应用程序,我得到以下消息:错误:“ InvalidRegistration”

If I use token from my Android colleague (or even token I got from launch app on simulator device) I succeed and got something like message id in response. 如果我使用来自我的Android同事的令牌(甚至是我从模拟器设备上的启动应用程序获得的令牌),则我会成功,并且得到诸如消息ID之类的信息作为响应。

How to fix that? 如何解决?

Your payload seems to be incorrect, try following command in terminal and adjust it as per your requirement: 您的有效负载似乎不正确,请在终端中尝试以下命令并根据需要进行调整:

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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS设备上的Firebase InstanceID令牌刷新延迟 - Firebase InstanceID Token Refresh delay on ios device Firebase 身份验证 iOS 12 无效令牌 - Firebase Authentication iOS 12 invalid token 在 iOS 从设备卸载应用程序或断开网络连接后,VOIP 令牌不会失效 - VOIP token won't get invalid after uninstalling an app from a device or disconnected from the network in iOS 设备令牌无效时将推送通知发送到ios设备崩溃 - Send push notification to ios device crash when device token is invalid Ionic Push FCM iOS - 获取设备令牌(不是 firebase 令牌) - Ionic Push FCM iOS - get device token (not firebase token) 如何在 flutter 应用程序中获取 iOS 设备令牌 - How to get iOS device token in flutter app 尝试在 IOS 真实设备中进行身份验证时出现“无效令牌” - "Invalid Token" when trying to authenticate in IOS real device 从APN迁移到Firebase后未重新生成iOS设备令牌 - iOS device token not regenerated after migration from APN to firebase Firebase 身份验证尝试使用 Apple 的身份令牌在 Xamarin.iOS 应用中返回 17999 INVALID_CREDENTIAL_OR_PROVIDER_ID - Firebase auth attempt to use an Apple's identity token returns 17999 INVALID_CREDENTIAL_OR_PROVIDER_ID in a Xamarin.iOS app Flutter firebase_auth 中的无效应用凭证/令牌不匹配 - invalid-app-credential/Token mismatch in Flutter firebase_auth
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM