设备在iOS 8.1上运行iOS 8.1推送通知无声音
我正在使用xCode 6.1编译应用程序。
这是为推动
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else
{
[application registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
它正常工作与服务器应用注册登记的代码。
PEM文件也正确完成,因为我可以使用沙盒APN将推送发送到我的设备。
当我打印我的JSON有效载荷从didReceiveRemoteNotification
我得到这个:
{
aps = {
alert = "Test Push Message";
};
}
的问题是,当我收到我的push(即使在设备设置为响亮的),不能播放声音。
据我所知,如果你没有在JSON载荷中指定声音,它应该播放默认的OS声音。
在我手机上的应用程序通知设置中,声音默认启用,因为当我注册时,我指定UIUserNotificationTypeSound
。
任何人都遇到过这个问题?
你不应该检测的版本,如:'如果([[[的UIDevice currentDevice] systemVersion]的floatValue]> = 8.0)'但像而检查类是可用的:'如果([ UIUserNotificationSettings类])' – rckoenes