简体   繁体   English

即使在删除应用程序iPhone后也会收到推送通知

[英]Receiving push notification even after the app is deleted iPhone

I implemented push notification in my app. 我在我的应用中实现了推送通知。

It is working fine. 它工作正常。

Now the problem is even after i deleted my app from device it is getting the push notifications. 现在问题是,即使我从设备中删除了我的应用程序,它正在获取推送通知。

So is there any way to unregister the app from push notification when it is deleted from the device. 因此,有什么方法可以在从设备中删除应用程序时从推送通知中取消注册该应用程序。

Hoping for your help. 希望得到你的帮助。

Thanks in advance. 提前致谢。

In Apple push notification there is something called - Feedback Service. 在Apple推送通知中有一些叫做 - 反馈服务。 So when a user deletes an app, the service provider should ideally stop sending notifications to that device. 因此,当用户删除应用程序时,服务提供商应该理想地停止向该设备发送通知。 But Apple does not notify the service that "this device is not using your app, dont send notifications". 但Apple没有通知服务“此设备未使用您的应用程序,请勿发送通知”。 So instead you need to poll for this info. 因此,您需要轮询此信息。

Every day you might need to hit Apple Notification servers asking it to give you device Ids who have deleted your app. 每天您可能需要点击Apple Notification服务器,要求它为您提供已删除应用程序的设备ID。 Once you get them you mark them in your DB as deleted thereby not sending any more notifications. 获得它们后,在数据库中将它们标记为已删除,从而不再发送任何通知。 Hope this is what you wanted. 希望这是你想要的。

From Apple Documentation - 来自Apple文档 -

... Apple Push Notification Service includes a feedback service that APNs continually updates with a per-application list of devices for which there were failed-delivery attempts. ... Apple推送通知服务包括一个反馈服务,APN不断更新,每个应用程序的设备列表都有失败的传递尝试。 The devices are identified by device tokens encoded in binary format. 设备由以二进制格式编码的设备令牌识别。 Providers should periodically query the feedback service to get the list of device tokens for their applications, each of which is identified by its topic. 提供者应定期查询反馈服务,以获取其应用程序的设备令牌列表,每个令牌都由其主题标识。 Then, after verifying that the application hasn't recently been re-registered on the identified devices, a provider should stop sending notifications to these devices. 然后,在验证应用程序最近未在所标识的设备上重新注册之后,提供商应该停止向这些设备发送通知。

Access to the feedback service takes place through a binary interface similar to that used for sending push notifications. 通过类似于用于发送推送通知的二进制接口来访问反馈服务。 You access the production feedback service via feedback.push.apple.com, port 2196; 您可以通过feedback.push.apple.com,端口2196访问生产反馈服务; you access the sandbox feedback service via feedback.sandbox.push.apple.com, port 2196. As with the binary interface for push notifications, you must use TLS (or SSL) to establish a secured communications channel. 您可以通过feedback.sandbox.push.apple.com,端口2196访问沙箱反馈服务。与推送通知的二进制接口一样,您必须使用TLS(或SSL)建立安全的通信通道。 The SSL certificate required for these connections is the same one that is provisioned for sending notifications. 这些连接所需的SSL证书与为发送通知而配置的SSL证书相同。 To establish a trusted provider identity, you should present this certificate to APNs at connection time using peer-to-peer authentication. 要建立可信的提供者身份,您应该在连接时使用对等身份验证将此证书提供给APN。

Be sure to checkout - Issues with Feedback Service 一定要结帐 - 反馈服务问题

Go to Settings, under Notifications, and disable all and any notifications for the offending app. 转到“通知”下的“设置”,然后禁用违规应用的所有通知和任何通知。 Not a permanent solution as you still have to find out and solve the root of the problem 不是永久解决方案,因为您仍然需要找出并解决问题的根源

Having not seen this answer so far, there is a small note in the Apple "Troubleshooting Push Notifications" document. 到目前为止还没有看到这个答案,Apple“故障排除推送通知”文档中有一个小注释。
In short, if you delete the last push enabled app, the persistent connection from the device to Apples push server is broken before the server is told that the app has been deleted. 简而言之,如果您删除最后一个推送启用的应用程序,则在服务器被告知应用程序已被删除之前,从设备到Apples推送服务器的持久连接已断开。
Solution: keep at least one push enabled app on your device. 解决方案:在您的设备上至少保留一个支持推送的应用。

There is the explanation from the document: 文件中有解释:

Issues with Using the Feedback Service If you remove your app from your device or computer and then send a push notification to it, you would expect to have the device token rejected, and the invalidated device token should appear on the feedback service. 使用反馈服务的问题如果从设备或计算机中删除应用程序,然后向其发送推送通知,则可能会拒绝设备令牌,并且反馈服务上应显示无效的设备令牌。 However, if this was the last push-enabled app on the device or computer, it will not show up in the feedback service. 但是,如果这是设备或计算机上最后一个支持推送的应用程序,它将不会显示在反馈服务中。 This is because deleting the last app tears down the persistent connection to the push service before the notice of the deletion can be sent. 这是因为删除最后一个应用程序会删除与推送服务的持久连接,然后才能发送删除通知。

You can work around this by leaving at least one push-enabled app on the device or computer in order to keep the persistent connection up. 您可以通过在设备或计算机上保留至少一个支持推送的应用程序来解决此问题,以便保持持久连接。 To keep the persistent connection to the production environment up, just install any free push-enabled app from the App Store and you should then be able to delete your app and see it appear in the feedback service. 要保持与生产环境的持久连接,只需从App Store安装任何免费的推送应用程序,然后您就可以删除应用程序并将其显示在反馈服务中。

Recall that each push environment has its own persistent connection. 回想一下,每个推送环境都有自己的持久连接。 So to keep the persistent connection to the sandbox environment up, install another development push-enabled app." 因此,要保持与沙盒环境的持久连接,请安装另一个支持开发推送的应用程序。“

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

相关问题 收到推送通知时,iPhone App崩溃 - iPhone App crashes when receiving push notification iPhone开发:在收到推送通知时启动应用程序 - iphone development: launching app on receiving push notification 在 iPhone 中没有收到任何推送通知 - Not receiving any push notification in iPhone Iphone没有收到IBM Mobilefirst IOS推送通知? - IBM Mobilefirst IOS Push notification not receiving in Iphone? 即使“优先级”设置为“高”,iOS上的GCM仍无法在强制退出APP时收到推送通知 - GCM on iOS not receiving push notification when APP is forced quit, even with “priority” set to high 有没有办法在收到推送通知时唤醒iOS应用程序,即使它已被杀死 - Is there a way to awaken an iOS app upon receiving a push notification even when it is killed 没有收到来自 firebase 的推送通知但是使用 Pusher 应用程序 - not receiving push notification from firebase But with Pusher app 收到推送通知后更改选定的选项卡 - Change selected tab after receiving Push Notification 为什么在收到推送通知后launchOptions为nil? - Why launchOptions is nil after receiving push notification? 收到推送通知后发出Web请求 - Make a web request after receiving a push notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM