Flutter IOS推送通知不起作用

问题描述 投票:0回答:1

在我的Flutter应用程序中,PUSH通知适用于Android,但对于IOS,我收到类似InvalidApnsCredentials的错误。

我创建了APN密钥并将其上传到Firebase Cloud Notification配置。然后,我下载了GoogleService-Info.plist并将其放在适当的位置。

我正在获取Iphone令牌并将其存储在Firebase中。然后,我尝试使用CURL命令发送PUSH通知。但这是说InvalidApnsCredentials。当我将令牌更改为Android令牌时,相同的命令也可以正常工作。

以下是我的命令和输出。

curl -X POST --header "Authorization: key=<API_KEY>" \
--Header "Content-Type: application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{\"to\":\"<DEVICE_TOKEN>\",\"notification\":{\"body\":\"Testing\"},\"priority\":10}"

IOS的输出是:

{“ multicast_id”:22362355730643526010,“成功”:0,“失败”:1,“ canonical_ids”:0,“结果”:[{“错误”:“ InvalidApnsCredential”}]}]

我在IOS推送通知中看到的所有示例,它们都使用作为Iphone开发人员签名证书,但对我来说,它显示的是[[Apple Developer。那可能是个问题吗?参见下图。

enter image description here

任何帮助将不胜感激。

iphone flutter firebase-notifications
1个回答
0
投票
您必须从苹果下载apn密钥,并逐步遵循this线程。
© www.soinside.com 2019 - 2024. All rights reserved.