我将使用AppNotify服务在我的应用中实施推送通知。要完成设置该服务,我需要获取我的设备令牌。我曾尝试使用Apple文档中的代码。在模拟器上,我收到一个错误(当然期望)。在我的设备上我没有收到错误,但我也没有收到该令牌。不会调用委托方法。下面是代码(第一位进去的applicationDidFinishLaunching):APNS - 获取设备令牌
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
//const void *devTokenBytes = [devToken bytes];
//self.registered = YES;
//[self sendProviderDeviceToken:devTokenBytes]; // custom method
NSLog(@"Success");
NSLog(@"Token = %@", devToken);
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
NSLog(@"Error in registration. Error: %@", err);
}
任何想法,为什么发生这种情况?
感谢