For iOS push notification services functionality we need a device token (a unique device id generated by device OS for Push Messages communications) on which we can receive push notification messages. To generate the device token we have to add UIApplication delegate methods of Push Notifications. Here is one of them which provides us device token.
Device token param will give you a string containing symbols and punctuation characters. before using that you have to clean it like this:-
- (void)application:(UIApplication)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData)deviceToken
{
NSString *deviceToken = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"Here is the device token : %@",deviceToken);
}
Happy Coding!!!
0 Comment(s)