gpt4 book ai didi

ios - 如何区分在应用程序中收到的推送通知和从应用程序外部触摸的推送通知?

转载 作者:可可西里 更新时间:2023-11-01 03:40:01 25 4
gpt4 key购买 nike

我在我的应用程序中设置了推送通知。我有方法:

 - (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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com