設備在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