@@ -119,12 +119,14 @@ - (void)voipRegistration
119119 NSLog (@" [RNVoipPushNotificationManager] voipRegistration" );
120120
121121 dispatch_queue_t mainQueue = dispatch_get_main_queue ();
122- // Create a push registry object
123- PKPushRegistry * voipRegistry = [[PKPushRegistry alloc ] initWithQueue: mainQueue];
124- // Set the registry's delegate to AppDelegate
125- voipRegistry.delegate = (RNVoipPushNotificationManager *)RCTSharedApplication ().delegate ;
126- // Set the push type to VoIP
127- voipRegistry.desiredPushTypes = [NSSet setWithObject: PKPushTypeVoIP];
122+ dispatch_async (mainQueue, ^{
123+ // Create a push registry object
124+ PKPushRegistry * voipRegistry = [[PKPushRegistry alloc ] initWithQueue: mainQueue];
125+ // Set the registry's delegate to AppDelegate
126+ voipRegistry.delegate = (RNVoipPushNotificationManager *)RCTSharedApplication ().delegate ;
127+ // Set the push type to VoIP
128+ voipRegistry.desiredPushTypes = [NSSet setWithObject: PKPushTypeVoIP];
129+ });
128130}
129131
130132- (NSDictionary *)checkPermissions
@@ -193,8 +195,10 @@ - (void)handleRemoteNotificationReceived:(NSNotification *)notification
193195 if (RCTRunningInAppExtension ()) {
194196 return ;
195197 }
198+ dispatch_async (dispatch_get_main_queue (), ^{
196199 [self registerUserNotification: permissions];
197200 [self voipRegistration ];
201+ });
198202}
199203
200204RCT_EXPORT_METHOD (checkPermissions:(RCTResponseSenderBlock)callback)
0 commit comments