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