本地消息推送

注册本地通知

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

application.applicationIconBadgeNumber = 0;

[[UIApplication sharedApplication] cancelAllLocalNotifications];

if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){

[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];

}

else {

[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge];

}

NSLog(@"%@",CURR_LANG);

return YES;

}


//触发本地通知

-(void)nonotificati{

UILocalNotification *notification=[[UILocalNotification alloc] init];

if (notification!=nil)

{

notification.soundName= UILocalNotificationDefaultSoundName;

notification.applicationIconBadgeNumber = [[[UIApplication sharedApplication] scheduledLocalNotifications] count]+1;

notification.alertBody=@"寻找手机";

[[UIApplication sharedApplication]   scheduleLocalNotification:notification];

}

}

你可能感兴趣的:(本地消息推送)