2

I'm developing an iOS app dealing with push notifications. Our push notification server is written in ColdFusion and is using com.notnoop.apns.SimpleApnsNotification to send the notifications. In the app, I grab the device token (NSData) and Base64 encode it before sending it off to the server. However, while the SimpleApnsNotification api is expecting a String for the token, it doesn't appear to want a Base64 encoded String.

Do you know what encoding SimpleApnsNotification is expecting for the device token?

1 Answer 1

2

You've got to hex encode it. Try making a Category on NSData with this method in it (this worked great for me):

 - (NSString*) hexEncode {
NSString *deviceToken = [[self description] stringByReplacingOccurrencesOfString: @"<" withString: @""];
deviceToken = [deviceToken stringByReplacingOccurrencesOfString: @">" withString: @""] ;
deviceToken = [deviceToken stringByReplacingOccurrencesOfString: @" " withString: @""];
return deviceToken;
}

Give that a try and see if it works for you, too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.