ios 8 以后本地通知需要注册:
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
if([[UIApplicationsharedApplication]respondsToSelector:@selector(registerForRemoteNotifications)]) {
UIUserNotificationTypetypes = (UIUserNotificationType)(UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert);
UIUserNotificationSettings* settings = [UIUserNotificationSettingssettingsForTypes:typescategories:nil];
[[UIApplicationsharedApplication]registerUserNotificationSettings:settings];
}
returnYES;
}