In the iPhone Push Notification documentation, they have a code snippet in which they override the UIApplication method that receives a device token -
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
const void *devTokenBytes = [devToken bytes];
self.registered = YES;
[self sendProviderDeviceToken:devTokenBytes]; // custom method
}
My question is, when I implement my own custom method, how do I use the devTokenBytes?
I need to create an HTTP Request, using NSURLConnection (I suppose), that will hand off the token to my server-side provider app. I get that part, but I'm not sure how to add devTokenBytes to the request? My first instinct was to use the bytes to create a String object, but when I try to using NSASCIIStringEncoding I get a weird jumbled mess of characters. I see that the return type of NSData's "bytes" method is a pointer, but I don't know what to do with it. What's the correct way to put this token into a request?
The documentation also details - "he application should connect with its provider and pass it this token, encoded in binary format." But I don't know how to handle something encoded in this manner.