ios 8 Parse 推送中没有声音 [英] No Sound in ios 8 Parse push
问题描述
这很奇怪,在更新我的应用程序以支持通过 Parse(使用 Parse 仪表板)发送的 iOS 8 推送通知后,推送通知不会发出任何声音.
This is weird, after updating my app to support iOS 8 push notifications sent through Parse (using the Parse dashboard) the push notifications wont make any sound.
我在 Stackoverflow 上发现了这个重复,但发布的答案对我不起作用:ios8 的 Parse 推送通知中没有声音
I found this duplicatie on Stackoverflow but the answer posted wasn't working for me: No sound in Parse push notification for ios8
- 我已经检查了通知中心并启用了消息和声音.
- 为应用创建了一个全新的干净版本
- 检查其他推送消息是否在应用上发出声音
- 使用 Parse rest api 并将声音设置为默认.
我尝试的所有方法都不起作用.
None of the things I tried worked.
使用解析代码更新了我的应用:
Updated my app using the Parse code:
// Register for Push Notitications, if running iOS 8
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
} else {
// Register for Push Notifications before iOS 8
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound)];
}
我在 Facebook dev 上发现了一个令人兴奋的错误报告:https://developers.facebook.com/bugs/719233564823090/
I found an excisting bug report on Facebook dev: https://developers.facebook.com/bugs/719233564823090/
推荐答案
您可以像这样在 Web 控制台中以 JSON 格式而不是文本格式发送推送通知:
You can send your push notifications in JSON format rather than the text format in the web console like so:
{"aps":{"alert":"This is a Test","sound":"default"}}
在 Parse 修复此错误之前,这是一种解决方法.
It's a workaround until Parse fixes this bug.
这篇关于ios 8 Parse 推送中没有声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!