苹果推送通知iOS 8.1.3上无声音播放
我遵循这一点,将所有内容都设置为在iOS上接收推送通知 我在Xcode中使用以下选项设置苹果推送通知iOS 8.1.3上无声音播放,ios,ios8,push-notification,apple-push-notifications,ios8.1,Ios,Ios8,Push Notification,Apple Push Notifications,Ios8.1,我遵循这一点,将所有内容都设置为在iOS上接收推送通知 我在Xcode中使用以下选项设置didfishlaunchingwithoptions: if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTy
didfishlaunchingwithoptions
:
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound) categories:nil]];
[application registerForRemoteNotifications];
} else {
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
我已注册(我可以获得deviceToken),并且在发送推送通知时可以从推送通知中获取消息,问题是我无法播放任何通知声音,我的pusher.php如下所示:
$body['aps'] = array(
'alert' => $message,
'sound' => "default"
);
我使用的是iOS 8.1.3我遇到了同样的问题,下面的代码似乎已经过时了:
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound |
UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else
{
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
if (application) {
application.applicationIconBadgeNumber = 0;
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|
UIUserNotificationTypeBadge|
UIUserNotificationTypeSound categories:nil]];
}
}
return YES;}
因为我只收到应用程序中的本地通知。即使在将正确的证书放在这之后。
到目前为止,Iv在这方面还没有找到任何帮助,所以最终通过电子邮件向苹果开发者技术支持发送了相关信息。这个问题有什么进展吗?您好,这是我从苹果得到的回复:我正在回答您关于苹果推送通知服务的问题。iOS 8.1.3中没有任何会影响推送通知的API更改。您是否碰巧从iOS 7 SDK升级?请求显示用户通知的权限与在iOS 8 SDK中注册推送通知是分开的。这只影响使用iOS 8 SDK构建的应用程序。使用旧SDK构建的应用程序应该仍然可以像以前一样工作。如果您移动到iOS 8 SDK而不相应地更改代码,您将在控制台日志中看到一条消息,说明旧API不再受支持。查看配置用户通知设置和注册新API的远程通知。谢谢。顺便说一句,我发现了我的问题:我的应用程序通知在设置中被一些魔法禁用:)