gpt4 book ai didi

iphone - 如何在iPhone的UILocalNotification中更改自定义声音?

转载 作者:行者123 更新时间:2023-12-01 18:27:17 26 4
gpt4 key购买 nike

我在ios的uilocalnotification中使用自定义声音。
但它不起作用。
文件存在于“文档”文件夹中。
通知正在使用local.soundName= UILocalNotificationDefaultSoundName;

        NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *path = [NSString stringWithFormat:@"%@/DingDongTone.wav",documentsPath];
local.soundName=path;

请帮忙。
谢谢。

最佳答案

请重新阅读苹果说的话-

对于此属性,请指定文件名(包括扩展名)
应用程序主捆绑中的声音资源,或
UILocalNotificationDefaultSoundName 请求默认系统
声音。当系统显示本地通知警报或
标记应用程序图标,它将播放此声音。默认值为
nil(无声音)。持续时间超过30秒的声音不会
支持的。如果您指定的文件播放的声音超过30
秒,将播放默认声音。

根据这个filenamepath资源中文件的main bundle,不在document directory

注意:文件的长度不能超过30 sec.

关于iphone - 如何在iPhone的UILocalNotification中更改自定义声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12347444/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com