Search code examples
notificationsapple-push-notificationsios9

Every Push Notification Banner is shown twice on iOS9


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?


Solution

  • 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.