IOS voip app with Push kit

I am working with a voip app using the Push Kit framework. I have some problems with the delivery of a remote notification.

Problems

1) Notification messages sent when the device is disconnected are lost permenantly

2) After restarting the device, no push notifications are received if the app doesn't start again

I have enabled voip via ip, background select, remote notification capabilities and check if there are any notifications on

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 NSDictionary* payload = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (payload) {
        // process the payload here
        NSLog(@"There are some notifications are available for processing");
    }
}

      

I have overridden the following methods

//PushKit Notification Alerts methods
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type{
    if([credentials.token length] == 0) {
        NSLog(@"voip token NULL");
        return;
    }
    NSLog(@"PushCredentials: %@", credentials.token);

}


- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type{       
    [self showLocalNotification:[[payload dictionaryPayload] valueForKey:@"data"]];
}

      

It works great when the app is in the foreground and when it is in the background. It also receives messages when the user forcibly leaves the app.

Version for testing OS platform: IOS 8.1 and higher Devices: iPhone 5C, iPhone 5S, iPhone 6, iPhone 6 +

+3


source to share


1 answer


According to the APN instructions, messages are stored in the APN when the target device is disabled and Apple will only keep the most recent message for each application, which means all other messages will be discarded.



See the store-and-forward section here: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW1

0


source







All Articles