我正在尝试使用此代码:https://stackoverflow.com/a/14063081/1011125。
但是在我的iPhone 4(iOS 7)上,这部分让整个应用程序崩溃:
dispatch_queue_t queue = dispatch_queue_create("cameraQueue", NULL);
[output setSampleBufferDelegate:self queue:queue];
这个小片段有什么问题?
OS Version: iOS 7.1 (11D169)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xe000000c
Triggered by Thread: 2
Thread 0:
0 libsystem_kernel.dylib 0x38e4da58 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x38e4d854 mach_msg + 44
2 CoreFoundation 0x2e0bb896 __CFRunLoopServiceMachPort + 150
3 CoreFoundation 0x2e0ba002 __CFRunLoopRun + 850
4 CoreFoundation 0x2e024f4a CFRunLoopRunSpecific + 518
5 CoreFoundation 0x2e024d2e CFRunLoopRunInMode + 102
6 GraphicsServices 0x32f2965e GSEventRunModal + 134
7 UIKit 0x30970168 UIApplicationMain + 1132
8 Lockr 0x00048fa0 main (main.m:16)
9 libdyld.dylib 0x38daaab4 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x38e4d808 kevent64 + 24
1 libdispatch.dylib 0x38d99de8 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x38d88f6e _dispatch_mgr_thread$VARIANT$up + 34
Thread 2 Crashed:
0 libobjc.A.dylib 0x388a7626 objc_msgSend + 6
1 AVFoundation 0x2d00dc16 __74-[AVCaptureVideoDataOutput _AVCaptureVideoDataOutput_VideoDataBecameReady]_block_invoke + 394
2 libdispatch.dylib 0x38d85830 _dispatch_call_block_and_release + 8
3 libdispatch.dylib 0x38d85de8 _dispatch_queue_drain$VARIANT$up + 440
4 libdispatch.dylib 0x38d86292 _dispatch_queue_invoke$VARIANT$up + 34
5 libdispatch.dylib 0x38d9888a _dispatch_root_queue_drain + 74
6 libdispatch.dylib 0x38d98b1c _dispatch_worker_thread2 + 52
7 libsystem_pthread.dylib 0x38ec7bd0 _pthread_wqthread + 296
8 libsystem_pthread.dylib 0x38ec7a94 start_wqthread + 4
Thread 3 name: com.apple.coremedia.player.async
Thread 3:
0 libsystem_kernel.dylib 0x38e4daa8 semaphore_wait_trap + 8
1 libdispatch.dylib 0x38d98f74 _dispatch_semaphore_wait_slow + 172
2 MediaToolbox 0x2f540ab4 fpa_AsyncMovieControlThread + 1752
3 CoreMedia 0x2e6531e0 figThreadMain + 192
4 libsystem_pthread.dylib 0x38ec9916 _pthread_body + 138
5 libsystem_pthread.dylib 0x38ec9886 _pthread_start + 98
6 libsystem_pthread.dylib 0x38ec7aa0 thread_start + 4
Thread 2 crashed with ARM Thread State (32-bit):
r0: 0x15dd6e60 r1: 0x30f39275 r2: 0x00000004 r3: 0x0000000d
r4: 0x15e58e20 r5: 0x30f39275 r6: 0x38f6696c r7: 0x02b93f3c
r8: 0x30f74e46 r9: 0xe0000000 r10: 0x2d07cd11 r11: 0x398b7cf8
ip: 0x38f3a8cc sp: 0x02b93ef8 lr: 0x2d00dc1b pc: 0x388a7626
cpsr: 0x60000030