title: swift 3.0 Data to String?
body: <pre><code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {}
  </code></pre>
  
  <p>I want <code>deviceToken</code> to string</p>
  
  <p>but:</p>
  
  <pre><code>let str = String.init(data: deviceToken, encoding: .utf8)
  </code></pre>
  
  <p><code>str</code> is <code>nil</code></p>
  
  <p>swift 3.0 </p>
  
  <p>how can I let <code>data</code> to <code>string</code> ?</p>
  
  <p><a href="https://stackoverflow.com/questions/37956482/registering-for-push-notifications-in-xcode-8-swift-3-0">Registering for Push Notifications in Xcode 8/Swift 3.0?</a>
  not working and the answer is a few months ago, I had tried it:</p>
  
  <p><a href="https://i.stack.imgur.com/tcqjQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tcqjQ.png" alt="enter image description here"></a></p>
  
  <p>and print:</p>
  
  <p><a href="https://i.stack.imgur.com/WKD6I.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WKD6I.png" alt="enter image description here"></a></p>