title: Saving deviceToken to NSUserDefaults
body: <p>I am trying to save device token to <code>NSUserDefaults</code> but I couldn't do it.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
      var currentToken=preferences.stringForKey(pushTokenKey)
      if currentToken != deviceToken {
          var dataString = NSString(data: deviceToken, encoding:NSUTF8StringEncoding) as String?
          self.preferences.setValue(dataString, forKey: pushTokenKey)
          self.preferences.synchronize()
      }
  }
  </code></pre>
  
  <p>You can see i am comparing the tokens and if they are not same i am updating it. But it is always saving as <code>nil</code> I guess because <code>deviceToken</code> is <code>NSData</code>. </p>
  
  <p>How can I resolve this problem ?</p>