From 07b93f0b62383c6dc02b8df9c3919db82b7782a1 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 27 Jul 2018 00:59:08 -0400 Subject: [PATCH] registerForRemoteNotifications is executed on main thread now. --- Notifications10ObjC/AppDelegate.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Notifications10ObjC/AppDelegate.m b/Notifications10ObjC/AppDelegate.m index e52cee3..bbfd982 100644 --- a/Notifications10ObjC/AppDelegate.m +++ b/Notifications10ObjC/AppDelegate.m @@ -101,7 +101,9 @@ - (void)registerForRemoteNotification { center.delegate = self; [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){ if( !error ){ + dispatch_async (dispatch_get_main_queue(), ^{ [[UIApplication sharedApplication] registerForRemoteNotifications]; + }); } }]; }