我按照demo写的代码。请问推送没有声音是为什呢?

Waiting1
2016-09-20 11:00 1.2k 0
  if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
//#ifdef __IPHONE_10_0
    JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
    entity.types = UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound;
    [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
//#endif
    }else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
        //可以添加自定义categories
        [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
                                                          UIUserNotificationTypeSound |
                                                          UIUserNotificationTypeAlert)
                                              categories:nil];

    }else {
        //categories 必须为nil
        [JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                                          UIRemoteNotificationTypeSound |
                                                          UIRemoteNotificationTypeAlert)
                                              categories:nil];
    }

1个回答

热门排序
  • 你给的代码里面看不到你怎么设置声音的。 你可以检查一下手机是否有静音。 如果是正确的设置了声音,手机收到的推送里面sound也正常,但是不播放声音,可以参考:https://community.jiguang.cn/t/ios-10-xco 展示全部