0

我的iOS應用程序聲音文件的放置位置有問題。在Android上,我不得不把它們放在platform/android/res/raw文件夾中,它工作。在iOS上,我在Xcode上打開了我的project.xcodeproj,但是當我將.mp3文件拖到Xcode項目中時,在我的iPad上清理,構建和運行項目時,我無法使自定義聲音起作用,我有默認聲音。iOS定製聲音通知位置

我PushInit:

var push = PushNotification.init({ 
      "android": { 
       "senderID": "xxxxx", 
       "alert": "true", 
       "badge": "true", 
       "sound": "true" 
      }, 
      "ios": { 
       "gcmSandbox": "true", 
       "senderID": "xxxxx", 
       "alert": "true", 
       "badge": "true", 
       "sound": "true" 
      }, 

這是我的工作負載:

{ 
"registration_ids":["xxxxx"], 
"notification": 
    { 
    "title":"Message", 
    "body":"Nouvelle intervention", 
    "vibrate":1, 
    "sound":"sirene" 
    }, 
"data": 
    { 
    "uid":"5811e9c946755", 
    "quittance":0 
    }, 
"priority":"high", 
"content_available":true 
} 

聲音 「Sirene酒店」 是一個文件的.caf。

screen shot 2016-10-27 at 13 56 57

我在哪裏必須把聲音文件?我只是將他們拖到項目中,然後添加到目標中。

如果我點擊我的聲音,路徑爲:

screen shot 2016-10-27 at 14 00 36

它放在這裏自動。

回答

2

您應該將它們導入資源項目中的文件夾,方法是將其拖放到xcode中。如果您使用的是iOS 10,則可能需要您在自定義聲音播放之前重新啓動手機。

+0

它仍然無法正常工作。我把它們放在資源文件夾中,添加到目標中,然後清理,構建並在我的iPad上運行。我應該刪除應用程序並重新安裝嗎? – Komarzer

+0

不應該不需要。我相信當定製自定義聲音時,iOS所選擇的Android需要文件擴展名。嘗試添加它... – iCediCe

+0

你是對的,非常感謝。這不是寫在他們的文件。再次感謝 ! – Komarzer