BundleIdentifier! = Nil when requesting authorization for iOS10 notifications through UNUserNotificationCenter.current (). requestAuthorization

I get an error when my package id is nil

2016-08-31 10: 39: 11.630 WeatherHop [52533: 17767791] * Application terminated due to an uncaught exception "NSInternalInconsistencyException", reason: "Invalid parameter that did not satisfy: bundleIdentifier! = Nil" * First stack of throw calls:

Cannot use this code:

        let bundleIdentifier = Bundle.main.bundleIdentifier

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

the print statement correctly identifies my package identifier as set in $ (PRODUCT_BUNDLE_IDENTIFIER)

Any idea why I am getting this error?

+4
source share
1

Core Data, photo.sqllite. LeanPlum SDK, , , iOS10. , SDK.

0

Source: https://habr.com/ru/post/1653177/


All Articles