///注销推送

[[UIApplication sharedApplication] unregisterForRemoteNotifications];

 

///注册推送

[[UIApplication sharedApplication] registerForRemoteNotifications];

 

///代码控制关闭系统推送提示音

给用户配置类设置一个sound健值 为nil就有声音 反之没声音

- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{

    // Required

    NSDictionary * userInfo = notification.request.content.userInfo;

    if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {

        [JPUSHService handleRemoteNotification:userInfo];

    }

    NSUserDefaults * userDefault = [NSUserDefaults standardUserDefaults];

    if ([userDefault objectForKey:@"sound"]) {

        AudioServicesPlaySystemSound(00);

    }else{

        AudioServicesPlaySystemSound(1312);

    }

    completionHandler(UNNotificationPresentationOptionAlert); // 需要执行这个方法,选择是否提醒用户,有BadgeSoundAlert三种类型可以选择设置

}