iOS自定义声音通知位置

iOS自定义声音通知位置,ios,ionic-framework,push-notification,google-cloud-messaging,apple-push-notifications,Ios,Ionic Framework,Push Notification,Google Cloud Messaging,Apple Push Notifications,我对iOS应用程序的声音文件放在哪里有些问题。在安卓系统上,我不得不把它们放在platform/android/res/raw文件夹中,这样做很有效。在iOS上,我在Xcode上打开了我的project.xcodeproj,但当我将.mp3文件拖到Xcode项目中,在我的iPad上清理、构建并运行该项目时,我无法使自定义声音工作,我有默认声音 我的PushInit: var push = PushNotification.init({ "android": {

我对iOS应用程序的声音文件放在哪里有些问题。在安卓系统上,我不得不把它们放在
platform/android/res/raw
文件夹中,这样做很有效。在iOS上,我在Xcode上打开了我的
project.xcodeproj
,但当我将.mp3文件拖到Xcode项目中,在我的iPad上清理、构建并运行该项目时,我无法使自定义声音工作,我有默认声音

我的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文件

我必须把声音文件放在哪里?我只是将它们拖到项目中,并添加到目标中

如果单击声音,路径为:


它会自动将它们放在这里。

您应该通过在xcode中将它们拖动到项目的Resources文件夹中来将它们导入。如果您使用的是iOS 10,则可能需要重新启动手机才能播放自定义声音

它仍然不起作用。我把它们放在Resources文件夹中,添加到target中,然后在我的iPad上进行清理、构建和运行。我应该删除应用程序并重新安装吗?不,不需要。我相信,当自定义声音被定义时,与Android相比,iOS需要文件扩展名。尝试添加它…你是对的,非常感谢。他们的文件里没有写。再次感谢!没问题。很高兴帮助你。