XCTest & UNUserNotificationCenter: requires bundle identifier, crashes when accessed
Originator: | bcriscuolo | ||
Number: | rdar://27768556 | Date Originated: | 08/09/16 |
Status: | Open | Resolved: | |
Product: | iOS SDK | Product Version: | iOS 10 |
Classification: | Causes Crash | Reproducible: | Always |
Summary: Our push notification SDK is migrating to use UNNotificationCenter for iOS 10 deployment targets. We have extensive unit and integration tests running in the simulator environments. We'd like to extend our tests to support UNNotificationCenter to generate local notifications for which we can test our SDK code. However, in doing so, even attempting to *access* the -currentNotificationCenter (via [UNUserNotificationCenter currentNotificationCenter]) crashes because xctest is not exposing a bundle identifier. 2016-08-09 13:21:36.308 xctest[24279:7991028] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: bundleIdentifier != nil' *** First throw call stack: ( 0 CoreFoundation 0x0000000101202a0b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000100c6421e objc_exception_throw + 48 2 CoreFoundation 0x0000000101206b02 +[NSException raise:format:arguments:] + 98 3 Foundation 0x00000001007fbd0d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 UserNotifications 0x0000000106c87b25 -[UNUserNotificationCenter initWithBundleIdentifier:] + 210 5 UserNotifications 0x0000000106c877cf __53+[UNUserNotificationCenter currentNotificationCenter]_block_invoke + 106 Steps to Reproduce: Steps to Reproduce: - Create a iOS test target with support for UserNotification.framework - Invoke [UNUserNotificationCenter currentNotificationCenter] in a unit test method -Attempt to test the code via XCTest Expected Results: Code will run / Test will execute Actual Results: Exception is throw (as detailed in Description) Version: Version 8.0 beta 4 (8S188o) Notes: Configuration: iOS 10 beta simulators Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!