Since upgrading to xcode 9, my iphone no longer receives notifications from Cloudkit. It worked fine until the upgrade
Here is the registration code:
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
{
if( !error && granted)
{
[[UIApplication sharedApplication] registerForRemoteNotifications]; /
NSLog( @"Push registration success." );
}
else
{
NSLog( @"Push registration FAILED" );
NSLog( @"ERROR: %@ - %@", error.localizedFailureReason, error.localizedDescription );
NSLog( @"SUGGESTIONS: %@ - %@", error.localizedRecoveryOptions, error.localizedRecoverySuggestion );
}
}];
I get this warning:
Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications]
PID: 617, TID: 327812, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4 Bubinga 0x0000000102c6fab4 __44-[AppDelegate registerForCloudNotifications]_block_invoke + 140
5 libdispatch.dylib 0x0000000102eb149c _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x0000000102eb145c _dispatch_client_callout + 16
7 libdispatch.dylib 0x0000000102ec0110 _dispatch_queue_serial_drain + 692
8 libdispatch.dylib 0x0000000102eb49a4 _dispatch_queue_invoke + 332
9 libdispatch.dylib 0x0000000102ec1104 _dispatch_root_queue_drain_deferred_wlh + 424
10 libdispatch.dylib 0x0000000102ec8100 _dispatch_workloop_worker_thread + 652
11 libsystem_pthread.dylib 0x0000000181062fe0 _pthread_wqthread + 932
12 libsystem_pthread.dylib 0x0000000181062c30 start_wqthread + 4
2017-10-19 17:13:34.744863-0600 Bubinga[617:327812] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications]
PID: 617, TID: 327812, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4 Bubinga 0x0000000102c6fab4 __44-[AppDelegate registerForCloudNotifications]_block_invoke + 140
5 libdispatch.dylib 0x0000000102eb149c _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x0000000102eb145c _dispatch_client_callout + 16
7 libdispatch.dylib 0x0000000102ec0110 _dispatch_queue_serial_drain + 692
8 libdispatch.dylib 0x0000000102eb49a4 _dispatch_queue_invoke + 332
9 libdispatch.dylib 0x0000000102ec1104 _dispatch_root_queue_drain_deferred_wlh + 424
10 libdispatch.dylib 0x0000000102ec8100 _dispatch_workloop_worker_thread + 652
11 libsystem_pthread.dylib 0x0000000181062fe0 _pthread_wqthread + 932
12 libsystem_pthread.dylib 0x0000000181062c30 start_wqthread + 4
2017-10-19 17:13:34.965072-0600 Bubinga[617:327812] Push registration success.
It seems to be registered due to this line:
2017-10-19 17:19:42.112553-0600 Bubinga[623:330054] Push registration success.
and this line:
application:didRegisterForRemoteNotificationsWithDeviceToken: with token = <blah blah blah 72433ca7 0d9c9b76 3343f285 b402c9d3 59b256fe b88cea97>
However, I no longer receive the Cloudkit notifications