Skip to content

Commit f49367b

Browse files
committed
Fixed receiving Voip push in background mode for iOS 13+.
1 parent 50652c4 commit f49367b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ios/Classes/CallKeep.m

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,16 @@ - (NSString *)createUUID {
220220
return [uuidStr lowercaseString];
221221
}
222222

223-
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
223+
224+
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(nonnull void (^)(void))completion {
224225
// Process the received push
225226
NSLog(@"didReceiveIncomingPushWithPayload payload = %@", payload.type);
226227
/* payload example.
227228
{
228229
"uuid": "xxxxx-xxxxx-xxxxx-xxxxx",
229230
"caller_id": "+8618612345678",
230231
"caller_name": "hello",
231-
"caller_id_type": "number",
232+
"caller_id_type": "number",
232233
"has_video": false,
233234
}
234235
*/
@@ -237,6 +238,9 @@ - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayloa
237238

238239
if (dic[@"aps"] != nil) {
239240
NSLog(@"Do not use the 'alert' format for push type %@.", payload.type);
241+
if(completion != nil) {
242+
completion();
243+
}
240244
return;
241245
}
242246

@@ -260,7 +264,13 @@ - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayloa
260264
localizedCallerName:callerName
261265
fromPushKit:YES
262266
payload:dic
263-
withCompletionHandler:^(){}];
267+
withCompletionHandler:completion];
268+
}
269+
270+
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
271+
[self pushRegistry:registry didReceiveIncomingPushWithPayload:payload forType:type withCompletionHandler:^(){
272+
NSLog(@"[CallKeep] received");
273+
}];
264274
}
265275

266276

0 commit comments

Comments
 (0)