每次加载应用程序时,它都会停止,就好像在此行上设置了断点一样:
self.audioPlayer =
[[[AVAudioPlayer alloc] initWithData:[dataPersister loadData:self.fileName]
error:&outError] autorelease];
该行上方或附近没有任何断点。它仅在我以调试模式运行应用程序时发生,并且断点后没有崩溃。当我单击“继续执行程序”时,该应用程序没有任何反应。
这是loadData方法,用调用initWithData
:
-(NSData*)loadData:(NSString*)fileName
{
NSString *dataPath = [self.path stringByAppendingPathComponent:fileName];
dataPath = [dataPath stringByStandardizingPath];
NSData *data = [[[NSData alloc] initWithContentsOfFile:dataPath]autorelease ];
return data;
}
loadData函数似乎工作正常。所请求的mp3文件在断点之后被加载并播放,没有任何问题。
你知道我在做什么错吗?
编辑: 当它在断点处停止时,我运行了回溯。这是输出:
(lldb)bt *线程#1:tid = 0x1c03,0x30df1724 libc ++ abi.dylib`__cxa_throw,停止原因=断点1.2 帧#0:0x30df1724 libc ++ abi.dylib`__cxa_throw 框架#1:0x36403a24 AudioToolbox`ID3ParserHandle :: ID3ParserHandle(void *,long(*)(void *,unsigned long,unsigned long,unsigned long,void **,unsigned long *))+ 452 框架#2:0x36403b0e AudioToolbox`ID3ParserOpen + 142 帧3:0x3635bd16 AudioToolbox`MPEGAudioFile :: ParseID3Tags()+ 58 帧4:0x3635b9aa AudioToolbox`MPEGAudioFile :: ParseAudioFile()+ 26 框架5:0x3631723e AudioToolbox`AudioFileObject :: DoOpenWithCallbacks(void *,long(*)(void *,long long,unsigned long,void *,unsigned long *),long(*)(void *,long long,unsigned long ,void const *,unsigned long *),long long(*)(void *),long(*)(void *,long long))+ 166 框架6:0x36316480 AudioToolbox`AudioFileOpenWithCallbacks + 612 帧#7:0x31f4c1ec AVFoundation`- [AVAudioPlayer initWithData:error:] + 120
“解决方案”:事实证明,如果我为所有异常禁用异常断点,而仅对Objective-C异常使用断点,问题就会消失。但是,它不能解决AVAudioPlayer的分配引发C ++异常的问题。