No Sound in ios 8 Parse push [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-10 13:59:11

问题


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.

I found this duplicatie on Stackoverflow but the answer posted wasn't working for me: No sound in Parse push notification for ios8

  • I already checked the notification center and messages and sounds are enabled.
  • Created a new clean build of the app
  • Checked if other push messages make sounds on the app
  • Used the Parse rest api and set the sound to default.

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)];
}

EDIT: I found an excisting bug report on Facebook dev: https://developers.facebook.com/bugs/719233564823090/


回答1:


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"}}

It's a workaround until Parse fixes this bug.



来源:https://stackoverflow.com/questions/26488243/no-sound-in-ios-8-parse-push

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!