To get a Token Device, you can take several steps :
1) Enable APNS (Apple Push Notification Service) for developer certification and certification distribution, then reload these two files.
2) Download the Provisioning Developer and Distribute Provisioning file again.
3) Settings for PROJECT and TARGETS with two file settings are loaded in the Xcode interface.
4) Finally, you need to add the code to the AppDelegate file to get the Token Device (note: run the application on a real device).
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window addSubview:viewController.view]; [self.window makeKeyAndVisible]; NSLog(@"Registering for push notifications..."); [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; return YES; } - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken]; NSLog(@"%@", str); } - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { NSString *str = [NSString stringWithFormat: @"Error: %@", err]; NSLog(@"%@",str); }
May 27 '13 at 3:56 Bkillnest 2013-05-27 03:56
source share