views:

221

answers:

1

I am going to implement push notifications in my app with the AppNotify service. To finish setting that service up I need to get my device token. I have tried using the code from Apple's docs. On the simulator I get an error (expected of course). On my device I do not get an error, but I do not get the token either. Neither delegate method is called. Here is the code (first bit goes in applicationDidFinishLaunching):

    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];



- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
//const void *devTokenBytes = [devToken bytes];
//self.registered = YES;
//[self sendProviderDeviceToken:devTokenBytes]; // custom method
NSLog(@"Success");
NSLog(@"Token = %@", devToken);
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
    NSLog(@"Error in registration. Error: %@", err);
}

Any ideas why this is happening?

Thanks

A: 

Once, you must know that remote notifications doesn't work on simulator.

Regards

fyasar