7 Replies
      Latest reply on Feb 14, 2019 4:44 AM by Evil Boy
      bcriscuolo Level 1 Level 1 (0 points)

        This is logged as rdar://27768556


        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.


        I've tried swizzling NSBundle (with no success) - UNUserNotificationCenter must be looking for the bundle ID in a way I can't identify.


        This tight dependency, and the lack of support for a bundle identifier via xctest, means that automation and unit tests (even to generate local notifications) cannot happen.

        Does anyone have any thoughts/tips/hints on this one? Thanks!


        Brian M. Criscuolo

        Salesforce Marketing Cloud


        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
          6   libdispatch.dylib                   0x0000000103ebf12e _dispatch_client_callout + 8
          7   libdispatch.dylib                   0x0000000103ea9e12 dispatch_once_f + 68
          8   UserNotifications                   0x0000000106c87762 +[UNUserNotificationCenter currentNotificationCenter] + 45