在我的应用中推送服务器通知时,我的设备无法播放声音。我搜索了很多,我尝试了所有推荐的解决方案,但我无法解决问题。不过,它给出了为问题标题写的错误。
这是我的代码:
// Register for Push Notitications, if running iOS 8
if (application.respondsToSelector(Selector("registerUserNotificationSettings:"))) {
var userNotificationTypes: UIUserNotificationType = (.Alert | .Badge | .Sound)
var settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
}
else
{
// Register for Push Notifications earlier from iOS 8
application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Badge | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Sound)
}
你能帮我吗?
感谢您的回答,
祝你好运
注意:我调试了“didReceiveRemoteNotification”方法,并且通知声音已经显示为“默认”。