title: calling registerForRemoteNotifications immediately after registerUserNotificationSettings?
body: <p>According to apple's <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW2" rel="nofollow noreferrer">guide</a> it suggests to register for notifications this way:</p>
  
  <pre><code>- (void)applicationDidFinishLaunching:(UIApplication *)app {
     // other setup tasks here....
  
     // Register the supported interaction types.
      UIUserNotificationType types = UIUserNotificationTypeBadge |
                   UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
      UIUserNotificationSettings *mySettings =
                  [UIUserNotificationSettings settingsForTypes:types categories:nil];
      [[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
  
     // Register for remote notifications.
      [[UIApplication sharedApplication] registerForRemoteNotifications];
  }
  </code></pre>
  
  <p>As shown above, it calls <code>registerForRemoteNotifications</code> immediately after <code>registerUserNotificationSettings</code> , but when the application is opened for the <strong>first time</strong> it wont succeed to get the access token because the user hasn't granted notification permission yet. </p>
  
  <p>In this way, the application will get the access token just if it was opened for the second time.</p>
  
  <p><strong>Why does apple suggest that?</strong></p>
  
  <p>What I suggest is calling <code>registerForRemoteNotifications</code> in <code>didRegisterUserNotificationSettings</code> because it will be called after the user grant notification permission.</p>
  
  <pre><code>   func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings){
  
  
         application.registerForRemoteNotifications()
  
      }
  </code></pre>
  
  <p><strong>Is my suggestion correct ?</strong></p>