title: Duplicate push notifications on iOS
body: <p>This question is probably the same as <a href="https://stackoverflow.com/questions/12866600/duplicate-apple-apns-push-notifications">Duplicate Apple APNS push notifications?</a>, but since that one didn't get an answer, and I have some more information, I'll try to ask it again.</p>
  
  <p>Steps to reproduce the problem:</p>
  
  <ul>
  <li>Set notification center to display notifications as alerts, this will make the problem more obvious.</li>
  <li>Make sure the app isn't running in the foreground.</li>
  <li>Send 3 identical push-notifications in rapid succession.</li>
  <li>Wait until the messages arrive at the phone, you will now have to dismiss the alert 3 times.</li>
  <li>Now send 1 more notification, that isn't identical with the previous ones.</li>
  <li>You now get that last notification, but you'll also get one of the previous notifications showing up once more. This is the problem.</li>
  <li>If you continue to send single notifications, one of the first 3 will keep popping up when it shouldn't.</li>
  </ul>
  
  <p>Here is a video that follow these steps, which clearly shows the problem:</p>
  
  <p><a href="http://youtu.be/TSqt8S4FY6w" rel="nofollow noreferrer">http://youtu.be/TSqt8S4FY6w</a></p>
  
  <p>We have just as Remy Gale did in the linked question above made sure that our notifications are sent in the correct way, and only once per notification. We have also tested this with both the sandbox-apns and the production-apns, both behave exactly the same.</p>
  
  <p>The problem disappears if the app-badge is set to 0, which in turn removes all notifications from notification center. Removing the notifications manually doesn't help.</p>
  
  <pre><code>UIApplication *app = [UIApplication sharedApplication];
  app.applicationIconBadgeNumber = 0;
  </code></pre>
  
  <p>But that isn't a solution.</p>
  
  <p>The problem doesn't appear if all notifications contain unique text. Adding a GUID to the alert-text will make the problem disappear. Adding it to the apns-payload as a custom property or as a localized argument will however not help, so this is also not a solution.</p>
  
  <p>This will probably rarely happen in a production environment with a live app, but it can happen, and when it does, it is really annoying for the users!</p>
  
  <p>Does anyone know why this happen? Does anyone have a viable solution?</p>