我有一个使用多个AVAudioPlayer对象播放音乐的应用。在iOS6上,此应用程序在被来电打断时崩溃。 iOS 4.3,5.0或5.1上不会出现此问题。当应用程序崩溃时,会看到以下堆栈跟踪。
(lldb)线程回溯
* thread#1:tid = 0x2403,0x3b905e64 libsystem_c.dylib pthread_mutex_lock + 388, stop reason = instruction step over
frame #0: 0x3b905e64 libsystem_c.dylib
pthread_mutex_lock + 388
帧#1:0x3299bd18 AVFoundation AVAudioPlayerCpp::sessionPropertyListener(unsigned long, unsigned long, void const*) + 124
frame #2: 0x33200b32 AudioToolbox
AudioSessionPropertyListeners :: CallPropertyListenersImp(unsigned long,unsigned long,void const *)+ 170
帧#3:0x332008cc AudioToolbox AudioSessionPropertyListeners::CallPropertyListeners(unsigned long, unsigned long, void const*) + 244
frame #4: 0x332b4afc AudioToolbox
ASCallbackReceiver_AudioSessionInterruptionListenerMessage + 184
帧#5:0x33389dde AudioToolbox _XAudioSessionInterruptionListenerMessage + 70
frame #6: 0x3320058a AudioToolbox
mshMIGPerform + 382
帧#7:0x337a33e6 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #8: 0x337a338a CoreFoundation
__ CFRunLoopDoSource1 + 138
帧#9:0x337a220e CoreFoundation __CFRunLoopRun + 1382
frame #10: 0x3371523c CoreFoundation
CFRunLoopRunSpecific + 356
帧#11:0x337150c8 CoreFoundation CFRunLoopRunInMode + 104
frame #12: 0x372f433a GraphicsServices
GSEventRunModal + 74
帧#13:0x356312b8 UIKit`UIApplicationMain + 1120
我添加了applicationWillResignActive,并且在崩溃发生时不会调用它。我还将我的app委托添加为AVAudioPlayer对象的委托,并实现了audioPlayerBeginInterruption方法。发生崩溃时也不会调用此方法。如果我只使用1或2个AVAudioPlayer对象,则崩溃就会消失。 3个AVAudioPlayer对象发生了崩溃,尽管其中只有2个在给定时间播放,其余的都已停止。
有没有人见过这种问题或有任何提示?
感谢。