Go Back
Set an iPhone App for APNS
APNS use a deviceToken to know where to send the push.
deviceToken is a uniqe number that generated for each app for your iPhone device.

To get the APNS work you need to add the following code to AppDelegate.m file:
@synthesize deviceToken;

- (void)applicationDidFinishLaunching:(UIApplication *)application {
	[[UIApplication sharedApplication]
	registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | 
					UIRemoteNotificationTypeSound |
	[window makeKeyAndVisible];

- (void)application:(UIAapplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)_deviceToken {
	self.deviceToken = [[[[_deviceToken description]
				stringByReplacingOccurrencesOfString:@">" withString:@""]
				stringByReplacingOccurrencesOfString:@" " withString:@""];

In the AppDelegate.h put:
// Under interface add:
NSString *deviceToken;

// Add the property
@property(nonatomic, retain) NSString *deviceToken;
All rights reserved to Tovi Levis. DO NOT copy or redistribute any content from this site.