Since a few hours we have a strange issue in our iOS app: every push notification received on the home screen of iOS will trigger/show the same notification banner twice with a 2 sec delay between them.
- It only happens on devices with iOS 9.x. On iOS 8.x devices everything is still working as expected.
- If I set a break point in -[AppDelegate application:didReceiveRemoteNotification:fetchCompletionHandler:] it is only called once for each push notification.
Also we did no change in the backend recently (at least a weak) and it also happens for client which are already released and we are 100% certain we did not see the issue before.
We did however change the capability in Xcode of the current development app and had to generate new provisioning profiles as the old ones where tagged as "Invalid".
So for us it looks like an issue on Apple sides. Any suggestions what more to try/check or what to do?
It seems like I had exactly the same issue as this dude had: I called [registerUserNotificationSettings:]
twice.
Be aware that it might not be as obvious as you think to see if you called the method once or twice:
I called it once on purpose in specific UIViewController. Unfortunately I also called it each time in didFinishLauchingWithOptions:
. Don't let yourself be fooled because you see the dialog only once.
If you want to be sure add a logging output in -[AppDelegate application:didRegisterUserNotificationSettings:]
. In my case the callback was called twice after I hit OK on the permission dialog.
Since I remove the misplace call in didFinishLauchingWithOptions:
I did not see anymore double notifications.
I submitted a bug report to Apple (Ticket# 23569779) and the issue appears to have been corrected in iOS 9.2.1 beta (Build: 13D11)
I was experiencing the same issue on iOS9.1 (Build: 13B143) and iOS9.2 (Build: 13c75) for both local and remote notifications across multiple apps.
The simplest way for me to recreate the issue is to schedule a local notification within my app delegate when the app is backgrounded.
- (void)applicationDidEnterBackground:(UIApplication *)application {
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.repeatInterval = NSDayCalendarUnit;
[notification setAlertBody:@"My test."];
[notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:1]];
[notification setTimeZone:[NSTimeZone defaultTimeZone]];
[application setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];
}
This will result in the notification banner appearing twice:
Duplicate banner images