gpt4 book ai didi

android - ionic 推送通知 : Not receiving in IOS

转载 作者:行者123 更新时间:2023-11-29 17:14:32 24 4
gpt4 key购买 nike

情况:

我使用 Ionic Push Notifications在我的应用程序中。

Android 一切正常。但是对于 IOS,我没有收到任何通知。

代码应该没问题。 token 的注册在 IOS 设备中也能正常工作。我可以在数据库中看到 token 。

此外,cURL 请求代码应该没问题,因为它适用于 android。

我将在下面粘贴所有可能有用的信息:

代码:

初始化:

$ionicCloudProvider.init({

"core":
{
"app_id": "MY_APP_ID"
},
"push":
{
"sender_id": "MY_SENDER_ID",
"pluginConfig": {
"ios": {
"badge": true,
"sound": true
}
}
}
});

io-config.json:

{"app_id":"MY_APP_ID","api_key":"MY_API_KEY","dev_push":false,"gcm_key":"MY_GCM_KEY"}

证书:

在 ionic.io 中,我设置了证书 - 生产模式 - 并激活了所有凭据: ionic.io certificate

在 Apple Developer Console 中,推送通知服务已正确启用(用于生产)

enter image description here

测试:

该应用已在应用商店中发布。

无论如何,我通过 XCODE(连接到它的设备)在本地进行了测试,并直接从应用商店下载了应用。

我从未收到任何通知。

使用 POSTMAN 进行测试,结果如下:

{
"data": {
"status": "open",
"uuid": "b55a9024-d0d9-480e-a813-02053bcf2f2a",
"created": "2016-09-19T14:05:01.097422+00:00",
"state": "enqueued",
"app_id": "MY_APP_ID",
"config": {
"tokens": [
"THE_RECEIVER_TOKEN"
],
"notification": {
"message": "Push test"
},
"profile": "MY_IONIC_IO_PROFILE"
}
},
"meta": {
"status": 201,
"request_id": "dbb57cba-3817-42ee-baaf-7175b5f6c755",
"version": "2.0.0-beta.0"
}
}

问题:

为什么我在 IOS 上收不到任何通知?

我错过了什么吗?

谢谢!

最佳答案

  • 确保在您的 iOS 设置应用中启用了通知
  • 尝试在推送负载中使用 content_available = true
  • 尝试在推送负载中使用 priority = "high"
  • 确保您没有在生产应用版本上使用开发证书发送,反之亦然
  • 确保您的 token 有效且已刷新

Docs about priority and content_available attributes

来自文档:

On iOS, set content_available when the app server needs to send a Send-to-Sync message. An inactive client app will execute your logic in the background, while an app in the foreground will pass the message to didReceiveRemoteNotification:.

关于android - ionic 推送通知 : Not receiving in IOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39575790/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com