does my app display second time notification iOS 9
Asked Answered
D

2

5

I am receiving the duplicate Notification. for both Remote notification and Local notifications.

I have used the following code

[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
}
else{
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
NSString *strDevicetoken = [[NSString alloc]initWithFormat:@"%@",[[[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""]];
NSLog(@"devicetoken = %@",strDevicetoken);}

i am Receiving Duplicate push notifications all the time.

Dormer answered 24/11, 2015 at 9:29 Comment(4)
Are duplicates both remote or both local notifications, or do you get a remote notification and then create a duplicate local notification?Selenography
The code you're showing is for registering for notifications. The real problem will be in either the code that posts local notifications or the code that processes receiving notifications. Edit your question to show those functions.Flick
@Selenography i mean if i am send Remote notification then device receive 2 same notification and for Local Notification : when i set Local notification same as itis show duplicate....Dormer
@VivekAghera i also face this problem.Millimeter
T
2

I think this is a bug on iOS9 somewhere. I have noticed that a large percentage of my app send duplicate notifications. StackoverFlow's iOS app, Apple's, iTunes Connect app and a few others. Pretty sure its the same issue you're having. Maybe file a radar with Apple.

Triangular answered 24/11, 2015 at 10:2 Comment(3)
Are you sure it's a iOS bug? Not a bug of your push provider?Anthracnose
Considering it was on multiple apps, which I assume use different push providers, yeah, I am sure it was a bug. It no longer happens. The problem went away.Triangular
weird, I've got this duplication issue recently on my iPhone 6 with iOS 9.3.2. But only once during the few weeks testing period. We have our own Push Provider, which logs I've investigated and found only one call to APNS ended up with two same push notifications on iOS Notification Center.Anthracnose
S
3

I had a similar issue, and in my case problem was in calling method registerUserNotificationSettings: two times. Seems that calling this method more than 1 time leads to duplicate notifications on iOS 9.

So if you have the same situation, try these two steps:

  1. Remove all extra calls of registerUserNotificationSettings: in your code.
  2. Then Reinstall the app.

This should fix the issue.

Schluter answered 28/1, 2016 at 15:2 Comment(6)
Hi, But what about if the code is already in production and I can't to force reinstall? The bug is still reproducing after the update.Crissum
You can't do anything for users that already have your app on their device, unfortunately. Except maybe inform them about the issue throughout website or/and appstore app description. To fix the issue they will have to reboot their device or reinstall it from the store.Schluter
Thanks for your answer, But how can you be sure of that? There is any answer from apple?Crissum
Are you sure it's a iOS bug? Not a bug of your push provider?Anthracnose
i am getting multiple notifications even i though i m calling registerUserNotificationSettings only once...Firebrat
I am facing same issue, I am calling the method once in application, I debug the app, the method is calling just only on installCardialgia
T
2

I think this is a bug on iOS9 somewhere. I have noticed that a large percentage of my app send duplicate notifications. StackoverFlow's iOS app, Apple's, iTunes Connect app and a few others. Pretty sure its the same issue you're having. Maybe file a radar with Apple.

Triangular answered 24/11, 2015 at 10:2 Comment(3)
Are you sure it's a iOS bug? Not a bug of your push provider?Anthracnose
Considering it was on multiple apps, which I assume use different push providers, yeah, I am sure it was a bug. It no longer happens. The problem went away.Triangular
weird, I've got this duplication issue recently on my iPhone 6 with iOS 9.3.2. But only once during the few weeks testing period. We have our own Push Provider, which logs I've investigated and found only one call to APNS ended up with two same push notifications on iOS Notification Center.Anthracnose

© 2022 - 2024 — McMap. All rights reserved.