gpt4 book ai didi

iphone - UILocalNotification 自定义声音

转载 作者:行者123 更新时间:2023-12-03 18:35:26 25 4
gpt4 key购买 nike

我已经寻找解决方案几个小时了..运气绝对为零。

我设置了本地通知:

UILocalNotification *notif = [[cls alloc] init];

[dateComp setDay:j+1];
[dateComp setHour:[[time objectAtIndex:0] integerValue]+offset];
[dateComp setMinute:[[time objectAtIndex:1] integerValue]];

NSLog(@"Year: %i, Month: %i, Day: %i, Time:%i:%i\n",[dateComp year], [dateComp month],
[dateComp day], [dateComp hour], [dateComp minute]);

notif.fireDate = [gregorian dateFromComponents:dateComp];
notif.timeZone = [NSTimeZone defaultTimeZone];

notif.alertBody = [names objectAtIndex: k];
notif.soundName = @"fireburn.caf";

注意声音名称...

我尝试输入 10 种声音(aiff、wav、caf...等),但通知只是以默认声音弹出:/

我的资源文件夹中有“fireburn.caf”文件。

为什么它不播放我的声音??????

谢谢。

最佳答案

答案:

代码没有问题..

只是愚蠢的 iPhone 没有取消我用默认声音发出的旧通知 -_-;

当我清理项目时,从手机中删除应用程序并重新启动手机然后它就可以工作了..

希望有人觉得这有帮助。

关于iphone - UILocalNotification 自定义声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4188848/

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