Frequent crashes getting currentNotificationCenter from UNUserNotificationCenter

I'm getting daily, frequent crashes with the following trace. This happens on the main thread when the application is launching in the foreground or in the background during a background fetch. The line it crashes on is simply:


UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];


trace:

Fatal Exception: NSInternalInconsistencyException

Invalid parameter not satisfying: bundleProxy != nil

0 CoreFoundation 0x1812a5d04 __exceptionPreprocess

1 libobjc.A.dylib 0x1804f4528 objc_exception_throw

2 CoreFoundation 0x1812a5bd8 +[NSException raise:format:]

3 Foundation 0x181c35c24 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]

4 UserNotifications 0x18a5e173c -[UNUserNotificationCenter initWithBundleProxy:]

5 UserNotifications 0x18a5e150c __53+[UNUserNotificationCenter currentNotificationCenter]_block_invoke

6 libdispatch.dylib 0x180c29048 _dispatch_client_callout

7 libdispatch.dylib 0x180c5b2b8 dispatch_once_f$VARIANT$armv81

8 UserNotifications 0x18a5e14ac +[UNUserNotificationCenter currentNotificationCenter]


I cannot reproduce this however. I'm seeing these reported in Crashlytics and similar complaints on Stackoverflow are unanswered. I'm not sure what the app is doing wrong. Seemingly the app has already been launched and is active.


Even a @try @catch around this does not help. I tried shipping the latest update with @try @catch around this line, but the assertion still manages to throw an exception.


Any ideas? It happens mostly on iOS 11 and have been reported for 11.2.6 as well.


I have filed a Radar for this: 38848058

Replies

did you figure it out?

Still reproduces