离子通知没有声音

Ionic Notification has no sound

看起来 Ionic 推送通知在过去几周发生了一些变化。

老办法

$ionicPush.register({
      canShowAlert: true, //Can pushes show an alert on your screen?
      canSetBadge: true, //Can pushes update app icon badges?
      canPlaySound: true, //Can notifications play a sound?
      canRunActionsOnWake: true, //Can run actions outside the app,
      onNotification: function(notification) {
        // Handle new push notifications here
        alert(notification);
        return true;
      }
    });

新方式

$ionicPush.init({
  "debug": true,
  "onNotification": function(notification) {
    var payload = notification.payload;
    console.log(notification, payload);
  },
  "onRegister": function(data) {
    console.log(data.token);
});

$ionicPush.register();

您可以看到最新版本中的不同代码阻止 iOS 具有声音和其他功能。我试图在 $ionicPush.init 中添加回 canPlaySound: true 但它没有用。

如何取回 ios 的所有通知功能列表?

更新

正确答案

$ionicPush.init({
  "debug": true,
  "onNotification": function(notification) {
    var payload = notification.payload;
    console.log(notification, payload);
  },
  "onRegister": function(data) {
    console.log(data.token);
  },
  "pluginConfig": {
    "ios": {
      "badge": true,
      "sound": true
     },
     "android": {
       "iconColor": "#343434"
     }
  }
});

这些是我添加到文档中的插件选项:

http://docs.ionic.io/docs/push-usage#section-plugin-options