• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - 通过从应用程序图标启动来处理应用程序完全关闭时的远程通知

[复制链接]
菜鸟教程小白 发表于 2022-12-12 08:53:56 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我可能会与风车搏斗,但我需要了解一下我对远程通知的了解。我想在我的应用程序关闭时处理通知(从应用程序切换器中杀死),但用户决定不是通过点击通知而是通过点击应用程序图标来打开它。

据我所知,当应用程序被杀死并且远程通知到达时,用户必须点击通知以在 didFinishLaunchingWithOptions:launchOptions 中传递它,但是......当用户点击应用程序图标并且没有任何内容传递给 lauchOptions 时,我想处理此通知。在那种情况下,目前我根本没有任何通知......

无论应用程序如何启动,是否可以在后台处理通知并对其执行操作?也许 didReceiveRemoteNotification: fetchCompletionHandler:



Best Answer-推荐答案


是的,你在和风车搏斗

我建议您阅读 Local and Push Notifications in depth .有点长,但是文档很清楚。

在此文档的片段中,您可以阅读:

If the application icon is tapped on a device running iOS, the application calls the same method (application:didFinishLaunchingWithOptions, but furnishes no information about the notification.

后来:

When handling remote notifications in application:didFinishLaunchingWithOptions: or applicationDidFinishLaunching:, the application delegate might perform a major additional task. Just after the application launches, the delegate should connect with its provider and fetch the waiting data. Listing 2-5 gives a schematic illustration of this procedure.

话虽如此,您可以为服务器中的每台设备提供已发送通知的列表,并且每次启动应用时检查设备是否有任何待处理的通知。

关于ios - 通过从应用程序图标启动来处理应用程序完全关闭时的远程通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22620952/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap