0
我想要的是当我的应用程序进入后台(当按下home按钮时)应该停止播放声音。我这样做的appDelegate.m但它说use of undeclared identifier 'soundID'
当应用程序进入后台时处理事件
- (void)applicationDidEnterBackground:(UIApplication *)application
{
AudioServicesDisposeSystemSoundID(soundID)
}
我已经导入我的VC到代表和也暴露了soundID
作为属性。我哪里错了?请帮忙。
NSString *path = [[NSBundle mainBundle] pathForResource:@"something" ofType:@"wav"];
NSURL *url = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID((CFURLRef)url, &soundID);
AudioServicesPlaySystemSound(soundID);
“必需的背景模式”键已经丢失。 – 2012-07-18 10:46:33
然后音频不应该在后台模式下播放!请发布您的代码如何播放音频。 – Kuba 2012-07-18 10:58:49
我正在使用短系统声音播放音频。我将编辑我的问题。 – 2012-07-18 11:07:37