0

I have create profile with push notification enabled. After installing IPA file in the device, the app is not fetching the device token. Does anyone know why this problem appears in my app?

Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55
Deepak
  • 1,278
  • 3
  • 15
  • 23
  • What exactly are you trying to do? You need to put something in your code to get the device token. – dgund Feb 28 '13 at 13:00

1 Answers1

0

in didFinishLaunchingWithOptions of your app delegate add the following line

[[UIApplication sharedApplication] 

   registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];

and then implement delegate function as

  - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
  {
       NSString *str = [[NSString stringWithFormat:@"%@",deviceToken] stringByReplacingOccurrencesOfString:@"<" withString:@""];
       str=[str stringByReplacingOccurrencesOfString:@">" withString:@""];
       str=[str stringByReplacingOccurrencesOfString:@" " withString:@""];

    //str is your device token and can used now.
   }
aBilal17
  • 2,974
  • 2
  • 17
  • 23