user2067201
user2067201

Reputation: 258

IOS voip app with Push kit

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

Issues

1) The notification messages send when the device was turned off is lost permenantly

2) After restarting the device, no push notification messages are recieved unless the application is started again

I have enabled voip over ip, background fetch, remote notification capabilities and checks any notification are available 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 overrided 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"]];
}

Its works fine when app is foreground and when its goes background. Its also receives messages when user forcibly quits the application.

Testing platform OS version : IOS 8.1 and above Devices:iPhone 5C,iPhone 5S,iPhone 6, iPhone 6+

Upvotes: 3

Views: 1265

Answers (1)

Ray
Ray

Reputation: 284

According to APNs Guides, messages are stored in APNs when target device is offline, and apple will only store the most recent message per app, it 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

Upvotes: 1

Related Questions