我在尝试实现 iOS-8 的新交互式通知时遇到了这个奇怪的问题。在处理本地通知时,一切都按预期工作,但在处理 APNS 时,一切都不太顺利。
详细信息:我通过横幅获得自定义推送(我只注册到最小上下文),但是当用户点击代表自定义操作的按钮时,我的应用程序的委托(delegate)applicationDidBecomeActive:
未被调用;事实上 - 该应用程序卡在非事件模式。
奇怪的是,当从“通知”屏幕(“今天”的右侧)启动时,该应用确实进入了事件模式。 除此之外,在这两种情况下,我的代表:
handleActionWithIdentifier:forRemoteNotification:completionHandler:
确实使用正确的标识符调用。
非常感谢任何帮助!
最佳答案
看起来这是一个 iOS 8 错误。在 Urban Airship 的 iOS 变更日志文档中发现如下内容:
iOS 8 Notes (Updated September 25, 2014)
Known issues with iOS 8.0.0 that may impact your application: - Applications do not enter the 'active' state when started from an interactive notification and subsequent app sessions do not receive the application:didBecomeActive delegate call or
UIApplicationDidBecomeActiveNotification notification. The application state never transitions out of 'inactive' (Radar #18179525). This will impact the accuracy of reporting for applications using interactive notifications.http://docs.urbanairship.com/reference/libraries/ios/latest/ios_changelog.txt
我没有发现任何迹象表明此问题已在最新的 iOS 8 版本(包括 8.1 和 8.2-Beta)中得到修复,也没有找到任何解决方法来解决它。
关于ios - 从横幅/自定义操作启动应用程序时未调用 applicationDidBecomeActive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26059927/