本地通知声音无效

Arp*_*ekh 5 iphone xcode cocoa-touch objective-c ios

在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];
Run Code Online (Sandbox Code Playgroud)

回答 得到傻点:通知声音只在你的应用程序处于后台或关闭时播放.对不起这个问题.不管怎样,谢谢.

Mut*_*awe 2

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

其他事情:

根据Apple开发者文档,您需要使用“aiff”、“caf”或“wav”文件。