title: Receiving duplicate push notification ios9
body: <p>I am receiving the same push notification twice in iOS9, although it is working fine in iOS8. </p>
  
  <p>I have used the following code to register with push notifications:</p>
  
  <pre><code>#if __IPHONE_OS_VERSION_MAX_ALLOWED &gt;= 80000
  
  if ([application respondsToSelector:@selector(registerUserNotificationSettings:)])
  {
      // use registerUserNotificationSettings
      UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:( UIUserNotificationTypeSound | UIUserNotificationTypeAlert|UIUserNotificationTypeBadge) categories:nil];
      [[UIApplication sharedApplication] registerUserNotificationSettings:setting];
      [[UIApplication sharedApplication] registerForRemoteNotifications];
  }
  else
  {
      // use registerForRemoteNotifications
      [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeBadge)];
  }
  
  #else
  
  // use registerForRemoteNotifications
  [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
  
  #endif
  </code></pre>