I am trying to resolve an issue with my app not receiving Push notifications any longer. The
pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:
method was not properly implemented. So far I've tried changing bundle ID, deleting and reinstalling the app. Is there something that could restart the notifications? Here is the current implementation:
:- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)())completion {
if (type == PKPushTypeVoIP) {
NSString *uuidString = payload.dictionaryPayload[@"UUID"];
NSString *handle = [payload.dictionaryPayload valueForKey: @"callerID"];
NSUUID *uuid = nil;
if (uuidString) {
uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
} else { NSLog(@"UUID is nil."); }
[self reportIncomingCall:uuid usingHandle:handle];
}
completion();
}
:- (void)reportIncomingCall:(NSUUID *)uuid usingHandle:(NSString *)handle {
CXCallUpdate *update = [CXCallUpdate new];
update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:[NSString stringWithFormat:@"%@", handle]];
if (uuid) {
} else { uuid = [NSUUID new]; }
[provider reportNewIncomingCallWithUUID:uuid update:update completion:^(NSError * _Nullable error) {
if (error == nil) {
NSLog(@"New incoming call reported to system.");
} else {
// handle error
NSLog(@"Call disallowed by the system, error: %@", error.localizedDescription);
}
}];
}
pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:
method was not properly implemented. So far I've tried changing bundle ID, deleting and reinstalling the app. Is there something that could restart the notifications? Here is the current implementation:
:- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)())completion {
if (type == PKPushTypeVoIP) {
NSString *uuidString = payload.dictionaryPayload[@"UUID"];
NSString *handle = [payload.dictionaryPayload valueForKey: @"callerID"];
NSUUID *uuid = nil;
if (uuidString) {
uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
} else { NSLog(@"UUID is nil."); }
[self reportIncomingCall:uuid usingHandle:handle];
}
completion();
}
:- (void)reportIncomingCall:(NSUUID *)uuid usingHandle:(NSString *)handle {
CXCallUpdate *update = [CXCallUpdate new];
update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:[NSString stringWithFormat:@"%@", handle]];
if (uuid) {
} else { uuid = [NSUUID new]; }
[provider reportNewIncomingCallWithUUID:uuid update:update completion:^(NSError * _Nullable error) {
if (error == nil) {
NSLog(@"New incoming call reported to system.");
} else {
// handle error
NSLog(@"Call disallowed by the system, error: %@", error.localizedDescription);
}
}];
}