在 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/