title: iOS device token callbacks never invoked
body: <p>I'm getting some major grief while trying to extract the device token in my applications. So far, I have</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  
      //register for push notifications
      [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
  </code></pre>
  
  <p>And then</p>
  
  <pre><code>-(void)application:(UIApplication *)app didRegisterForRemoteNotificationsWith:DeviceToken:(NSData *)deviceToken 
  {
      NSString *str = [deviceToken description]; 
      NSLog(@"%@", str); 
  }
  
  - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
  {
      NSLog(@"Failed to get token, error: %@", error);
  }
  </code></pre>
  
  <p>Here's the deal.</p>
  
  <p>my iOS Simulator: I get</p>
  
  <pre><code> Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x5813d20 {NSLocalizedDescription=remote notifications are not supported in the simulator}
  </code></pre>
  
  <p>as expected.</p>
  
  <p>On my iPod Touch, 2nd gen, running iOS 4.2, neither of the callbacks are ever invoked. The same happens on my coworkers iPhone 4s running iOS 5.1.1 </p>
  
  <p>Finally, on another coworkers iPhone 4 running iOS.5.1.1, it seems to be returning that the device token is "com.apple.mobileconfig"... which is very odd.</p>
  
  <p>I've verified that notifications are enabled for the app on my device. I've also verified that my app identifier bundle is set up correctly in xCode.</p>
  
  <p><strong>EDIT:</strong> I have no clue what happened, but, a few days after posting this thread, I plugged an iPhone 4 into my mac and the device token callbacks just started working in debug mode, and then on everyone else's devices also. I made a few changes to the provisioning profile (had to add the new device's UDID, etc), so that could have knocked something glitchy out of it. Not really sure.</p>
  
  <p><strong>EDIT2:</strong> It appears there was an extra colon in the didRegister callback, right before <code>DeviceToken</code> ...</p>