title: registerForRemoteNotifications() Callbacks not being called
body: <p>This question has been asked (e.g. <a href="https://stackoverflow.com/questions/3224605/iphone-registerforremotenotificationtypes-does-not-generate-an-error-but-does-no">here</a> and <a href="https://stackoverflow.com/questions/6631710/push-notification-delegate-call-backs-are-not-getting-called">here</a>), but none of the solutions seems to apply to my setup.</p>
  <p>I am developing an app in iOS 9 / Xcode7 (beta 5).</p>
  <p>I have created an explicit App ID / bundle identifier.
  (The app ID is automatically generated by Xcode, but is listen in the Developer Portal as <code>Xcode iOS App ID com mycompanyname mayappname</code>).</p>
  <p>I have configured my target's &quot;Capabilities&quot; in Xcode to add support for push notifications.</p>
  <p>I have configured my App ID in the developer portal to support push notifications:
  I created and downloaded a development APNs certificate, and installed in my keychain (not sure this is needed? I thought this cert is intended for my server? But just to be safe in case it is needed at build time?)</p>
  <p>I am running the app from Xcode on the device: iPhone 5s, iOS 9, 4G connectivity, Wi-Fi turned off (just in case).</p>
  <p>My app is not listed in the device's Settings.app, &quot;Notifications&quot; section, so there's nothing I can enable there...</p>
  <p>I initiate the registration process like this:</p>
  <pre><code>func application(application: UIApplication,
          didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?
          ) -&gt; Bool
  {
      application.registerForRemoteNotifications()
          
      return true
  }
  </code></pre>
  <p>I have implemented both:</p>
  <pre><code>func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData)
  {
  
  }
  </code></pre>
  <p>...and:</p>
  <pre><code>func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError)
  {
         
  }
  </code></pre>
  <p>and setup breakpoints/logs on both, but neither gets called.</p>
  <p>What can be happening?</p>
  <p><strong>EDIT:</strong> It is working now, but only if I call <strong><em>both</em></strong> <code>registerForRemoteNotifications()</code> <strong><em>and</em></strong> <code>registerUserNotificationSettings()</code> at launch.</p>
  <p>I was working under the assumtion that I should first call <code>registerForRemoteNotifications()</code>, and on success (i.e., <code>application(_:didRegisterForRemoteNotificationsWithDeviceToken)</code>) I should in turn call <code>registerUserNotificationSettings()</code> to specify the types of notifications (and prompt the user). The docs do not make clear which of these two functions must be called first; in particular, the inline docs for <code>registerForRemoteNotifications()</code> say:</p>
  <blockquote>
  <p>[...] Call this method to initiate the registration process[...]</p>
  </blockquote>
  <p>, which seems to suggest that it alone triggers the whole thing. However, the <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">programming guide</a> has the following step-by-step instructions:</p>
  <blockquote>
  <ol>
  <li>Register the notification types your app supports using registerUserNotificationSettings:.</li>
  <li>Register to receive push notifications via APNs by calling your app’s registerForRemoteNotifications method.</li>
  <li>Store the device token returned to the app delegate by the server for a successful registration, or handle registration failure
  gracefully.</li>
  <li>Forward the device token to the app’s push provider.</li>
  </ol>
  </blockquote>
  <hr />
  <h3>Update (Jan 2015):</h3>
  <p>I moved on to another project so I didn't follow up the issue or find a definitive response. Still listening to any helpful info...</p>