title: iOS APNS: sending the device token to the provider in string format
body: <p>I need to send the APNS device token of my iOS app to my provider by calling a service that expects JSON data in my request. I'm reading Apple's <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW2" rel="noreferrer">Local and Push Notification Programming Guide</a> and it only says that the <code>application:didRegisterForRemoteNotificationsWithDeviceToken:</code> delegate method passes the device token as <code>NSData</code> and you should pass it to your provider encoded in binary data. But I need it to be converted to string in order to be able to send a JSON request to my provider.</p>
  
  <p>I've also been reading several posts related to this, since it looks it is a common scenario, but I've found some different ways to convert such device token to string to send it, and I'm not sure which of them should be the most appropriate. Which would the most reliable way to deal with this be? I suppose my provider will need to convert this string back to call APNS, and I also need to store this token in the app in order to safely compare it with the new value if a new token is generated and <code>application:didRegisterForRemoteNotificationsWithDeviceToken:</code> is called, to send the token only if it has changed.</p>
  
  <p>Thanks</p>