diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 0f99f8319..22d146076 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -436,7 +436,7 @@ return; } - NSString *loc_key = [aps objectForKey:@"loc-key"]; + NSString *loc_key = [aps objectForKey:@"loc-key"] ?: [[aps objectForKey:@"alert"] objectForKey:@"loc-key"]; NSString *callId = [aps objectForKey:@"call-id"] ?: @""; if (!loc_key) { LOGE(@"Notification [%p] has no loc_key, it's impossible to process it.", userInfo); @@ -486,6 +486,12 @@ } - (BOOL)addLongTaskIDforCallID:(NSString *)callId { + if (!callId) + return FALSE; + + if ([callId isEqualToString:@""]) + return FALSE; + NSDictionary *dict = LinphoneManager.instance.pushDict; if ([[dict allKeys] indexOfObject:callId] != NSNotFound) return FALSE; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 3e59c5e5a..cf111d288 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2161,6 +2161,12 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } - (void)startPushLongRunningTask:(NSString *)loc_key callId:(NSString *)callId { + if (!callId) + return; + + if ([callId isEqualToString:@""]) + return; + if ([loc_key isEqualToString:@"IM_MSG"]) { [[UIApplication sharedApplication] endBackgroundTask:pushBgTaskMsg]; pushBgTaskMsg = 0;