ios - bundleIdentifier != nil 当通过 UNUserNotificationCenter.current().requestAuthorization 请求 iOS10 通知授权时

标签 ios ios10 xcode8

我遇到一个崩溃,说我的 bundle ID 是 nil

2016-08-31 10:39:11.630 WeatherHop[52533:17767791] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: bundleIdentifier != nil' * First throw call stack:

使用此代码失败:

        let bundleIdentifier = Bundle.main.bundleIdentifier

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

打印语句正确识别了我的包 ID,如 $(PRODUCT_BUNDLE_IDENTIFIER) 中所设置

知道我为什么会收到此错误吗?

最佳答案

我最终找出了这个错误的根本原因和另一个提到 photos.sqllite 的核心数据错误。我安装了 LeanPlum SDK,我猜它与 iOS10 有一些已知的兼容性问题。他们承认了这些问题,并 promise 很快会推出新的 SDK。

关于ios - bundleIdentifier != nil 当通过 UNUserNotificationCenter.current().requestAuthorization 请求 iOS10 通知授权时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39252871/

相关文章:

ios - 每个顶点颜色的 SceneKit

ios - 在每一帧上执行 drawRect?

ios - 如何使用Swift在UICollectionView中显示/隐藏单元格?

ios - 错误 : __tcp_connection_write_eof_block_invoke Write close callback received error - iOS 10

swift - 如何使用另一个类的选择器?

ios - 以编程方式设置 UIButton 的图像?

ios - '*** -[__NSArrayM insertObject :atIndex:]: object cannot be nil' when performing UITableView animated reload

ios - ios 10 的模拟器 .app 在 ios 8 中不起作用

ios - Xcode 8 说供应配置文件具有 aps-environment 权利但导出后存档 aps-environment 丢失

xcode - 在 Xcode 8 中更改默认缩进宽度