遵循以下步骤: 补充:
[[UIApplication sharedApplication]registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound)];
然后实施,
(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
}
但是,得到以下错误:
Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x90445d0 {NSLocalizedDescription=remote notifications are not supported in the simulator}
请帮忙。
答案 0 :(得分:2)
当您的iOS应用在iOS模拟器中运行时尝试注册推送通知时,会显示此错误消息。
该错误说明当应用程序在模拟器中运行时,不支持推送通知。该应用必须在设备上运行才能注册推送通知。