【问题标题】:bundleIdentifier != nil when requesting iOS10 notification authorization via UNUserNotificationCenter.current().requestAuthorizationbundleIdentifier != nil 当通过 UNUserNotificationCenter.current().requestAuthorization 请求 iOS10 通知授权时
【发布时间】:2017-01-08 05:40:50
【问题描述】:

我遇到了崩溃,提示我的捆绑包 ID 为 nil

2016-08-31 10:39:11.630 WeatherHop[52533:17767791] * 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无效参数不满足:bundleIdentifier!= nil” * 首先抛出调用栈:

使用此代码失败:

        let bundleIdentifier = Bundle.main.bundleIdentifier

    print("\(bundleIdentifier)")
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
        if granted {
        }....

打印语句正确识别了我在 $(PRODUCT_BUNDLE_IDENTIFIER) 中设置的捆绑包 ID

知道为什么会出现此错误吗?

【问题讨论】:

  • 您介意包括调用堆栈吗?或者甚至可以分享一个示例项目?
  • 我们刚刚也收到了一份崩溃报告……但只有 1. iOS 10.0.1 上的 iPhone 6s……有修复/解决方法还是侥幸?
  • 我建议您检查您可能正在使用的任何 3rd 方库,因为这对我来说是解决方法。具体来说,如果我没记错的话,是 Leanplum SDK 中的“Leanplum.syncResourcesAsync(true)”调用

标签: ios ios10 xcode8


【解决方案1】:

我最终找出了这个错误的根本原因以及另一个提到 photos.sqllite 的 Core Data 错误。我安装了 LeanPlum SDK,我猜它与 iOS10 存在一些已知的兼容性问题。他们承认了这些问题,并承诺很快就会推出新的 SDK。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-05
    • 2019-04-18
    • 2019-09-24
    • 2013-12-11
    • 2018-07-16
    • 2021-12-30
    • 1970-01-01
    • 2019-08-23
    相关资源
    最近更新 更多