We added Push Notifications to our App but we need help with sending the Device Token to our database. As of right now we have our database set up so all we have to do is get our Device Token from the NSLog and put it at the end of the database’s URL:http://www8.XXXXXXX.net/XXXXX_push/register.cfm?token=TOKEN_HERE
If we use Safari we can just type that in the URL bar with the real Token at the end then hit enter and the database receives Token.
We Fell that we need to put code in the App under:
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
But we just don’t know what code to use…As we are really new to this.
Could someone please let us know what code to use to send the NSURL that we have made?
P.S. here is what we have so far:
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *str = [NSString
stringWithFormat:@"Device Token=%@",deviceToken];
NSLog(str);
NSString *fullURL = [NSString stringWithFormat:@"http://www8.xxxxxxxxx.net/xxxxx_push/register.cfm?token=%@",str];
NSURL *tokenURL = [NSURL URLWithString:fullURL];
}
didRegisterForRemoteNotificationsWithDeviceToken is the right spot for waht you are doing.
I use this code, borrowed from urbanairship.com, to clean up the deviceToken before sending it back via a NSURLConnection PUT to the urbanairship servers.