应用程序打开时处理推送通知 [英] Handling Push Notification While App is Open
问题描述
我的推送通知正在运行。有用。我收到通知并使用
I have my Push Notification running. It works. I receive a notification and use
application:didReceiveRemoteNotification:
获取传入的数据然后将用户发送到必要的屏幕。
to get the incoming data and then send the user to the necessary screen.
问题是,如果你正在使用收到应用程序和通知后,它会跳转到目标屏幕,而不会发出任何警报/声音/任何内容。
Problem is, if you are using the App and a notification is received, it jumps to the destination screen without giving any alert/sound/anything.
我可以在中发出警报应用程序:didReceiveRemoteNotification:
,但随后会出现该警报,而不仅仅是应用程序运行时。
I could put an alert in application:didReceiveRemoteNotification:
, but then that alert would appear every time, not just when the app is running.
关于如何处理此问题的想法?
Ideas about how to handle this?
推荐答案
我建议检查UIApplication中的applicationState属性,以确定应用程序是否在后台运行。
I would recommend checking the applicationState property in UIApplication to determine if the app is running in the background or not.
这篇关于应用程序打开时处理推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!