title: Get the push notification token - iOS 10, Swift 3
body: <p>How to get the device token from new <strong>xCode 8</strong>, <strong>Swift 3</strong> in <strong>iOS 10</strong>?</p>
  
  <p>Here is the code to register notification:</p>
  
  <pre><code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {    
  
      DispatchQueue.main.async {
          let settings = UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)
          UIApplication.shared.registerUserNotificationSettings(settings)
      }
      return true
  }
  
  func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
  
      if notificationSettings.types != UIUserNotificationType() {
          application.registerForRemoteNotifications()
      }
  }
  </code></pre>
  
  <p>Here i get the token, but i get the following error </p>
  
  <pre><code>Cannot invoke initializer for type 'UnsafePointer&lt;CChar&gt;' with an argument list of type '(UnsafeRawPointer)':
  </code></pre>
  
  <hr>
  
  <pre><code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  
      let chars = UnsafePointer&lt;CChar&gt;((deviceToken as NSData).bytes)
      var token = ""
  
      for i in 0..&lt;deviceToken.count {
          token += String(format: "%02.2hhx", arguments: [chars[i]])
      }
  
      print("Registration succeeded!")
      print("Token: ", token)
  }
  </code></pre>
  
  <p>Can anyone help me solve it?</p>