Apple Push Notification-Unable to callback didRegisterForRemoteNotificationsWithDeviceToken

Posted by Shailesh Kanzariya on Stack Overflow See other posts from Stack Overflow or by Shailesh Kanzariya
Published on 2009-10-05T11:00:54Z Indexed on 2010/04/03 2:03 UTC
Read the original article Hit count: 694

Filed under:
|
|

I have been simply trying to get deviceToken from my iPhone application using Apple Push Notification Service. I don't have any implementation on server side for the time being. I have created APP Id, got SSL certificate, Provision Profile with APN and calling

- (void)applicationDidFinishLaunching:(UIApplication *)application {
//view init and add sub view to window
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
}

method. When I execute the application it pop ups action box to allow Push Notification (means my request for APN registration is working) but my callback is not executed. Neither didRegisterForRemoteNotificationsWithDeviceToken nor didFailToRegisterForRemoteNotificationsWithError is called? can anybody help me to resolve the issue? Following are my callbacs for reference.

    - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {

            UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"APNClient" message:@"Entered into Error Method" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [myAlert show];
            [myAlert release];
            NSLog(@"Error in registration. Error: %@", err);

        }
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
    UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"APNClient" message:@"Got the deviceToken..!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [myAlert show];
    [myAlert release];        
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about apns