iOS 本地通知

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;

}

你可能感兴趣的:(iOS 本地通知)