Atulkumar V. Jain
Atulkumar V. Jain

Reputation: 5098

How to get devicetoken of iphone for push notification?

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)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
     const void *devTokenBytes = [devToken bytes];
     NSLog(@"devToken=%@",devTokenBytes);
     //[self alertNotice:@"" withMSG:[NSString stringWithFormat:@"devToken=%@",devToken] cancleButtonTitle:NSLocalizedString(@"OK",@"") otherButtonTitle:@""];
    //self.registered = YES;
    //[self sendProviderDeviceToken:devTokenBytes]; // custom method    
}

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

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)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] 
 registerForRemoteNotificationTypes:
 (UIRemoteNotificationTypeAlert | 
  UIRemoteNotificationTypeBadge | 
  UIRemoteNotificationTypeSound)];

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...

Upvotes: 0

Views: 2491

Answers (1)

NP Compete
NP Compete

Reputation: 2379

Seems that you have answered it yourself. Jailbroken iPhones will have problems receiving push notifications, as far as i know, but i am not absolutely sure. Were you able to get development/production certificates using this iPhone's UDID for installing apps?

Upvotes: 2

Related Questions