title: How do I prompt the user for push notification permission after a button is pushed?
body: <p>I read <a href="https://stackoverflow.com/questions/30817069/how-to-control-when-to-prompt-user-for-push-notification-permissions-in-ios">How to control when to prompt user for push notification permissions in iOS</a> and similar questions but they weren't written in Swift 3. </p>
  
  <p>I have read <a href="https://stackoverflow.com/questions/37956482/registering-for-push-notifications-in-xcode-8-swift-3-0/37956783">Registering for Push Notifications in Xcode 8/Swift 3.0?</a> five times. </p>
  
  <p>I ran my app in Simulator over and over but <strong>after the first time, the app never prompted the user for push notification permission.</strong></p>
  
  <p>I used the code from <a href="https://stackoverflow.com/questions/37956482/registering-for-push-notifications-in-xcode-8-swift-3-0/37956783">Registering for Push Notifications in Xcode 8/Swift 3.0?</a> and kept trying different answers and moving the code to different places so that <em>the user would be asked for permission only after they pressed a certain button, and not immediately</em> when the app launched. </p>
  
  <p><strong>Do I have to be registered with an Apple ID etc. for the push notification code to even <em>work</em> in Simulator?</strong> </p>