我构建了获取推送通知的 xcode 应用程序,主要问题是推送通知对我来说非常关键。 所以我想检查推送通知是否已发送到安装了应用程序的设备,我知道如果 iphone 没有互联网连接/3G,则推送通知不会到达设备。
如何检查设备是否收到通知? 如何检查 APNS 是否成功发送推送通知?
如果推送通知未发送到设备,我想发送短信,所以我考虑在推送通知打开时获取通知事件,并向我的服务器发送请求,这样我就可以知道是否推送通知是否成功发送。主要问题是用户每次收到通知时都需要打开应用程序,而在晚上这是个问题。所以这个选项对我不利。
我查看了反馈服务器推送通知,但我没有找到任何关于推送通知是否送达的信息
有什么想法吗??
最佳答案
在 iOS7 中你有一个新的方法叫做 应用程序:didReceiveRemoteNotification:fetchCompletionHandler: 您可能可以将其用于您的任务。来自 Apple's Docs :
Implement this method if your app supports the remote-notification background mode. ... When a push notification arrives, the system displays the notification to the user and launches the app in the background (if needed) so that it can call this method. Use this method to download any data related to the push notification. When your method is done, call the block in the handler parameter.
Unlike the application:didReceiveRemoteNotification: method, which is called only when your app is running, the system calls this method regardless of the state of your app.
关于iphone - 知道苹果应用程序是否收到推送通知的任何选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9731826/