iphone - 知道苹果应用程序是否收到推送通知的任何选项?

标签 iphone objective-c xcode apple-push-notifications

我构建了获取推送通知的 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/

相关文章:

ios - 我什么时候以及为什么要使用 ARC 将局部变量声明为 __weak?

ios - 我如何获取应用程序开发人员发布的应用程序商店评论

iphone - 如何在3.0模拟器上正确运行应用程序?

iphone - 为什么被调用者返回自动释放的对象而不是返回保留的对象并让调用者释放对象?

objective-c - 指针在 FSEventStream 回调中丢失(ObjC 和 ARC)

ios - 应用程序加载器卡住,但状态为 "Waiting for Review"

iphone - 如何获取背景音乐的当前输出 dB 值以在 iOS 中显示声级计?

objective-c - 将 Objective-C block 转换为 Swift 闭包

objective-c - 如果我将它用作 NSSheet,则 NSWindow 颜色不会改变。如何解决这个问题?

ios - Swift Array of Arrays 终止了 Xcode 索引,因此 type-ahead 不起作用