2

I have adapted this code from How to use device tokens in different ways in iphone?

- (void)sendProviderDeviceToken:(NSString *)tokenString {
NSString *udid = [[UIDevice currentDevice] uniqueIdentifier];

NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier];
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

NSString *data = [NSString stringWithFormat:@"udid=%@&token=%@&id=%@&type=%i", udid, tokenString, bundleID, type];
NSString *escapedData = [[data description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSString *httpRequestURLString = [NSString stringWithFormat:@"http://%@/RegisterDevice.cgi?%@", kRegistrationURI, escapedData];
NSURL    *httpRequestURL       = [NSURL URLWithString:httpRequestURLString];
}

and the code works correctly when the device is tethered but as soon as I disconnect the device it stops working.

Clearly there is something I am missing but it is not obvious

This is my first question here. I hope I am following proper form ...

Community
  • 1
  • 1
jbrown94305
  • 185
  • 2
  • 11
  • 1
    Just a quick note. Apple won't let your app through if you are using UDID in that way. You should be using CFUUID instead. See this answer... http://stackoverflow.com/questions/9631608/alternative-to-iphone-device-id-udid – Fogmeister Oct 08 '12 at 18:31

0 Answers0