首页 > 移动平台 > 详细

ios 开发 推送消息的设置

时间:2017-05-19 10:52:26      阅读:370      评论:0      收藏:0      [点我收藏+]

///注销推送

[[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三种类型可以选择设置

}

ios 开发 推送消息的设置

原文:http://www.cnblogs.com/MyFairyZoe/p/6877188.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!