Welcome to the iMore Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread AuthorThread Author   #1  
    atuljain_1985's Avatar
    iPhone Nanite

    1 Posts

    Post How to Get Devicetoken of Iphone for Push Notification?

    Hi everybody,

    I am trying to use the push notification service provided by apple but I am not able to get the device token required for pushing the notification. I am using the following code for retrieving the device token

    - (void)applicationUIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken NSData *)devToken {
    const void *devTokenBytes = [devToken bytes];
    //[self alertNotice:@"" withMSG:[NSString stringWithFormat:@"devToken=%@",devToken] cancleButtonTitle:NSLocalizedString(@"OK",@"") otherButtonTitle:@""];
    //self.registered = YES;
    //[self sendProviderDeviceToken:devTokenBytes]; // custom method

    /*NSString *preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0];
    const char *langStr = [preferredLang UTF8String];
    [self sendProviderCurrentLanguage:langStr]; // custom method*/


    - (void)applicationUIApplication *)app didFailToRegisterForRemoteNotificationsWithError NSError *)err {
    NSLog(@"Error in registration. Error: %@", err);

    - (void)applicationUIApplication *)application didReceiveRemoteNotificationNSDictionary *)userInfo {

    for (id key in userInfo) {
    NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);

    I am registering for the remote notification using the following code

    [[UIApplication sharedApplication]
    (UIRemoteNotificationTypeAlert |
    UIRemoteNotificationTypeBadge |
    Can anyone help me with this...

    I am having the following warning message in the console window

    warning: Unable to read symbols for "/Library/MobileSubstrate/MobileSubstrate.dylib" (file not found).
    Is it to do something with the jailbroken iphone...

    Thanx in advance...

Posting Permissions