gpt4 book ai didi

iphone - 本地通知声音不起作用

转载 作者:可可西里 更新时间:2023-11-01 04:42:23 24 4
gpt4 key购买 nike

在 iPhone 应用中,

我正在设置本地通知。

我正在设置自定义声音。

收到通知时我“听不到”任何声音。甚至没有默认声音。

既不在我的 iPod touch 中,也不在我的设备中。

谁能帮我找出原因?

非常感谢。

这是代码。

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

localNotification.fireDate=[dateFormat dateFromString:alarm_date];

localNotification.alertBody = @"Alarm.";

localNotification.soundName = [filePath lastPathComponent];

//localNotification.soundName =soundname;
//UILocalNotificationDefaultSoundName;

localNotification.applicationIconBadgeNumber = 1;

localNotification.alertAction=@"Show";


[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

[localNotification release];

回答明白了愚蠢的一点:通知声音全部仅在您的应用程序处于后台或关闭时播放。对不起这个问题。无论如何谢谢。

最佳答案

声音应小于 30 秒才能作为通知声音播放

其他:

根据 Apple Developer Documentation,您需要使用“aiff”、“caf”或“wav”文件。

关于iphone - 本地通知声音不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12172175/

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