我正在编写一个使用音频队列服务播放音乐的应用。当它到达一首歌的结尾时,它应该继续下一首。它在调试方案中工作正常,但它在发布方案中崩溃了
Process: xxx [1136]
Path: /Users/USER/Desktop/btunes.app/Contents/MacOS/xxx
Identifier: xxx
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd [152]
Responsible: xxx [1136]
User ID: 501
Date/Time: 2014-03-18 09:33:15.557 -0700
OS Version: Mac OS X 10.9.2 (13C64)
Report Version: 11
Anonymous UUID: 57FFD284-4D30-889E-73D0-CE978BAFC774
Crashed Thread: 6 com.apple.coreaudio.AQClient
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000280000018
VM Regions Near 0x280000018:
CG shared images 00000001c7eb2000-00000001c7eba000 [ 32K] r--/r-- SM=SHM
-->
JS JIT generated code 00005b8cc8000000-00005b8cc8001000 [ 4K] ---/rwx SM=NUL
Application Specific Information:
objc_msgSend() selector name: delegate
Thread 6 Crashed:: com.apple.coreaudio.AQClient
0 libobjc.A.dylib 0x00007fff85742097 objc_msgSend + 23
1 com.cluttered.btunes 0x000000010aced249 -[BTSAudioStreamer handleAudioQueueProperty] + 136 (BTSAudioStreamer.m:180)
2 com.apple.audio.toolbox.AudioToolbox 0x00007fff87af6f6d ClientAudioQueue::PropertyChanged(unsigned int) + 415
3 com.apple.audio.toolbox.AudioToolbox 0x00007fff87afc97c AQClientCallbackMessageReader::DispatchCallbacks(void const*, unsigned long) + 440
4 com.apple.audio.toolbox.AudioToolbox 0x00007fff87af742e ClientAudioQueue::FetchAndDeliverPendingCallbacks(unsigned int) + 334
5 com.apple.audio.toolbox.AudioToolbox 0x00007fff87af7554 AQCallbackReceiver_CallbackNotificationsAvailable + 129
6 com.apple.audio.toolbox.AudioToolbox 0x00007fff87b1777c _XCallbackNotificationsAvailable + 48
7 com.apple.audio.toolbox.AudioToolbox 0x00007fff87b111bf mshMIGPerform + 153
8 com.apple.CoreFoundation 0x00007fff81adc9a9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
9 com.apple.CoreFoundation 0x00007fff81adc91e __CFRunLoopDoSource1 + 478
10 com.apple.CoreFoundation 0x00007fff81acda16 __CFRunLoopRun + 1830
11 com.apple.CoreFoundation 0x00007fff81acd0b5 CFRunLoopRunSpecific + 309
12 com.apple.audio.toolbox.AudioToolbox 0x00007fff87afe479 GenericRunLoopThread::Entry(void*) + 187
13 com.apple.audio.toolbox.AudioToolbox 0x00007fff87ab7c0d CAPThread::Entry(CAPThread*) + 109
14 libsystem_pthread.dylib 0x00007fff87db1899 _pthread_body + 138
15 libsystem_pthread.dylib 0x00007fff87db172a _pthread_start + 137
16 libsystem_pthread.dylib 0x00007fff87db5fc9 thread_start + 13
第180行
if (self.delegate) {
委托是(弱),我在dealloc中将self.delegate设置为nil。看起来音频队列属性监听器即使在我删除它之后也会继续运行(我也在dealloc中进行)。
我不明白为什么它只在发布模式下发生。现在我只是在Debug中存档应用程序,但这显然不太理想。有什么想法吗?
答案 0 :(得分:2)
释义/引用this post以保留知识。
看起来不同的优化级别存在问题。在fast
运行优化会导致某些环境崩溃。
"跳出来的一个区别是Optmization Level设置。 Debug版本设置为None [-O0],而Release版本设置为Fastest,Smallest [-Os]。
我将Debug设置更改为Fastest,Smallest [-Os]和BOOM,每次运行时它都会在iPhone 3G上崩溃。将其切换回无[-O0]会恢复正确的行为。"