【问题标题】:No Sound in ios 8 Parse push [duplicate]ios 8 Parse push中没有声音[重复]
【发布时间】:2014-12-16 18:27:27
【问题描述】:

这很奇怪,在更新我的应用程序以支持通过 Parse 发送的 iOS 8 推送通知(使用 Parse 仪表板)后,推送通知不会发出任何声音。

我在 Stackoverflow 上找到了这个副本,但发布的答案对我不起作用:No sound in Parse push notification for ios8

  • 我已经检查了通知中心并且启用了消息和声音。
  • 创建了应用的全新干净版本
  • 检查其他推送消息是否在应用程序上发出声音
  • 使用 Parse rest api 并将声音设置为默认值。

我尝试过的所有方法都不起作用。

使用 Parse 代码更新了我的应用:

// 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 开发人员上发现了一个令人兴奋的错误报告:https://developers.facebook.com/bugs/719233564823090/

【问题讨论】:

  • 我遇到了同样的问题。我在 iOS 8 之前发布的所有应用程序在调用时都没有激活 UIRemoteNotificationTypeSound。
  • 在下一次 SDK 更新中提供了一个修复程序。

标签: ios xcode push-notification parse-platform apple-push-notifications


【解决方案1】:

您可以使用 JSON 格式而不是 Web 控制台中的文本格式发送推送通知,如下所示:

  {"aps":{"alert":"This is a Test","sound":"default"}}

在 Parse 修复此错误之前,这是一种解决方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-06
    • 1970-01-01
    • 2018-09-12
    • 2015-08-09
    • 2012-01-06
    相关资源
    最近更新 更多