Choose custom sound for local notifications

后端 未结 6 867
囚心锁ツ
囚心锁ツ 2020-11-27 15:31

How do you change the sound that plays for local notifications? I use the code below to play the default sound:

notif.soundName = UILocalNotificationDefaultS         


        
6条回答
  •  孤街浪徒
    2020-11-27 16:08

    That should work. Make sure the sound is actually in your app’s bundle, is in the correct format (linear PCM or IMA4—pretty much anywhere that explains how to convert sounds for iOS will tell you how to do that), and is under 30 seconds.

提交回复
热议问题