在iOS8.0之后如果没注册本地通知就会报出的提醒,如下图:
解决的办法是:在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
这个方法中注册通知:
if ([[UIDevice currentDevice].systemVersion doubleValue]>=8.0) {
UIUserNotificationSettings* settings=[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil];
[application registerUserNotificationSettings:settings];
}
return YES;
时间: 2024-10-25 15:44:00