ios - 禁用通知时,未在前台调用 didreceiveremotenotification

标签 ios objective-c swift notifications

如果用户未授予通知权限,则当应用程序位于前台时收到远程通知时,不会调用 didreceiveremotenotification。我不想使用无声通知,因为当应用程序在后台并且用户允许通知时,我希望出现警报通知。但是当在前台时,我想自己处理通知数据,即使用户已选择退出通知。

如何实现这一目标?

编辑:我发现当用户禁用通知时不会创 build 备注册 token 。但是静默通知如何运作呢?

最佳答案

我找到了以下答案:What is difference between remote notification and silent notification in iOS?

简而言之,为了实现我想要的,我需要在 plist 的 Bacground 模式中启用远程通知。然后,即使用户选择不接收通知,我也能够注册 token 。

关于ios - 禁用通知时,未在前台调用 didreceiveremotenotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45970750/

相关文章:

iphone - 是否值得将 JSON 存储到核心数据对象中?

ios - 在左侧菜单 SWRevealViewController objective c 中移动了 View 项

ios - 使用 Firebase 应用程序打开 url 选项的 GoogleSignIn 未调用

设备过热的 iOS 通知

iphone - 使用 ARC 时声明委托(delegate)

iOS 更新 TableViewCell 内容并重新加载

ios - 设置后缺少 AFNetworking 请求 header

iPhone : How to sync data with the web-service when internet is reachable?

ios - Alamofire 请求为零

iOS如何知道坐标是否正确