这是该应用程序第一次安装在此设备上,并且从未注册过推送通知,但它拒绝询问。我使用以下代码,但无论我清理项目多少次,删除派生数据,在我的设备上卸载并重新安装应用程序,它都不会问我是否要接收推送通知。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication]
setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]autorelease];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
为什么它不会要求我注册通知?我检查了设置中的通知,这个应用程序没有列出。