我有一個簡單的代碼來播放聲音通過AVAudioPlayer
AVAusioSession PTY錯誤模擬器
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"beep"
ofType:@"mp3"]];
self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
self.player.volume = 1;
[self.player prepareToPlay];
我的異常斷點會停在prepareToPlay
和控制檯日誌中寫道:
ERROR: AVAudioSessionUtilities.h:111: GetProperty: AudioSessionGetProperty ('prp?') failed with error: 'pty?
2倍攻傳後通過這個斷點,應用程序不會崩潰。這隻發生在模擬器中。 有什麼建議嗎?