我的应用程序中有推送通知设置。我有方法:
- (void)application:(UIApplication *)application didReceiveRemoteNotification: (NSDictionary *)userInfo
{
if()
{
//app is in foreground to get here
}
else if()
{
//app is in background and then the notification is clicked, to get here
}
}
我需要区分在应用程序外部对通知的触摸,并简单地在应用程序中接收通知。有什么帮助吗?
最佳答案
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if ( application.applicationState == UIApplicationStateActive )
// app was already in the foreground
else
// app was just brought from background to foreground
...
}
关于ios - 我该如何区分应用内收到的推送通知和应用外触摸的推送通知?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17612036/