suj*_*uji 1 iphone objective-c
我将本地通知集成到我的应用程序中
它工作正常.
但客户希望使用不同的声音进行本地通知.
我将文件拖放到xcode的支持文件中
谁能帮助我如何做到这一点.
code
AlocalNotifas.soundName = @"cling.wav";
localNotifas.soundName = [[NSBundle mainBundle] pathForResource:@"cling" ofType:@".wav"];
// [localNotifas setSoundName:[[NSBundle mainBundle] pathForResource:@"cling" ofType:@"wav"]];
// [localNotifas setSoundName:UILocalNotificationDefaultSoundName];
Run Code Online (Sandbox Code Playgroud)
你可以请专家告诉我哪里出错了.
Pet*_*ski 16
请记住,您的通知声音可能不会超过30秒 - 如果提供的文件较长,则不会发出任何声音.
此外,首先检查某些外部播放器中的声音,并最好将其转换为.caf格式.
要将文件转换为.caf,请打开终端,转到存储声音的位置并输入:
afconvert -f caff -d LEI16@44100 -c 1 yourfile.wav yourfile.caf
Run Code Online (Sandbox Code Playgroud)
然后将它设置为:
yourNotification.soundName = @"yoursound_name.caf";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5176 次 |
| 最近记录: |