是否可以处理后台收到的苹果推送通知?

发布于 2024-12-13 06:10:57 字数 54 浏览 5 评论 0原文

是否可以区分用户何时手动恢复应用程序或接受推送通知?

我还想处理推送通知参数。

Is possible to distinguish when user manually resume application or accept push notification?

I also want to handle push notification params.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帥小哥 2024-12-20 06:10:57

我认为您正在寻找 didReceiveRemoteNotification,这是推送通知到达时调用的方法。

您需要查看 UIApplication Delegate Protocol Reference !还有一些其他方法可用于远程通知。

- (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
...
}

I think you are looking for the didReceiveRemoteNotification, which is the the method that gets called when a push notification arrives.

You need to look at the UIApplication Delegate Protocol Reference! There are a couple of other methods too for remote notifications.

- (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
...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文