如何知道推送式通知是否收到How to know if push notification recieved

- 此内容更新于:2015-01-27
主题:

我使用推送式通知应用程序。 我我的应用程序打开时执行一些逻辑通过通知; 我使用 方法。 我可以知道,当我的应用程序收到通知,没有此外吗?

原文:

I'm using push notification on my app. I'm executing some logic when my app is opened via notification; I'm using for it

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

method.

Can I know, when my app recieving notification, without oppening it?

Wain的回复:方法将调用,如果负载是合适的,在用户收到通知消息。我# 39;我不清楚你的问题是什么。

(原文:That method will be called, if the payload is appropriate, before the user is notified that the message is received. I'm not clear what your problem is.)

解决方案:
由于您发布委托方法将被称为当系统接收到通知。您可以使用用户信息字典接到通知的内容。
原文:

Because the delegate method you posted will be called when the system receives a notification. You can use the userInfo dictionary to acces the content of the notification.

Arthur的回复:是的。但我# 39;m要求-有方法知道应用程序收到推送

(原文:Yes. But I'm asking - Is there a method to know that app recived push)

Christian的回复:这种委托方法被称为应用程序关闭时,收到一个通知。我不要,不明白你的问题,对不起

(原文:This delegated method is called when the app is closed and receive a notification. I don't understand your problem, sorry)

解决方案:
时您可以推动本地通知应用程序背景或不活跃的,所以你可以看到推送内容,没有打开它。
原文:

You can push a local notification when your app is in background or inactive, so you can see the push content, no to open it.