由于某些原因,我的应用程序崩溃了,我不确定导致问题的原因除了它似乎与处理文件时跨越的调度队列有关。任何帮助将不胜感激。
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000038
VM Regions Near 0x38:
-->
__TEXT 00000001018e7000-000000010190b000 [ 144K] r-x/rwx SM=COW /Users/USER/Desktop/MaviÃÅ 10.8 Build.app/Contents/MacOS/MaviÃÅ
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libdispatch.dylib 0x00007fff8c83dc28 dispatch_async_f + 3
1 com.larod.mavi 0x00000001018f6e12 0x1018e7000 + 65042
2 com.apple.AppKit 0x00007fff890df99e -[NSTableView performDragOperation:] + 215
3 com.apple.AppKit 0x00007fff88f2c94f NSCoreDragReceiveMessageProc + 1651
4 com.apple.HIServices 0x00007fff8a8f046a DoMultipartDropMessage + 301
5 com.apple.HIServices 0x00007fff8a8f0135 DoDropMessage + 49
6 com.apple.HIServices 0x00007fff8a8f0c5e CoreDragMessageHandler + 1543
7 com.apple.CoreFoundation 0x00007fff89ca858d __CFMessagePortPerform + 701
8 com.apple.CoreFoundation 0x00007fff89bbcd09 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
9 com.apple.CoreFoundation 0x00007fff89bbca49 __CFRunLoopDoSource1 + 153
10 com.apple.CoreFoundation 0x00007fff89befc02 __CFRunLoopRun + 1826
11 com.apple.CoreFoundation 0x00007fff89bef0e2 CFRunLoopRunSpecific + 290
12 com.apple.HIToolbox 0x00007fff8871beb4 RunCurrentEventLoopInMode + 209
13 com.apple.HIToolbox 0x00007fff8871bc52 ReceiveNextEventCommon + 356
14 com.apple.HIToolbox 0x00007fff8871bae3 BlockUntilNextEventMatchingListInMode + 62
15 com.apple.AppKit 0x00007fff88bdb533 _DPSNextEvent + 685
16 com.apple.AppKit 0x00007fff88bdadf2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
17 com.apple.AppKit 0x00007fff88bd21a3 -[NSApplication run] + 517
18 com.apple.AppKit 0x00007fff88b76bd6 NSApplicationMain + 869
19 libdyld.dylib 0x00007fff85ff97e1 start + 1
Thread 1:
0 libsystem_kernel.dylib 0x00007fff8404a6d6 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8c8bdf1c _pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8c8bdce3 _pthread_wqthread + 412
3 libsystem_c.dylib 0x00007fff8c8a8191 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8404ad16 kevent + 10
1 libdispatch.dylib 0x00007fff8c83fdea _dispatch_mgr_invoke + 883
2 libdispatch.dylib 0x00007fff8c83f9ee _dispatch_mgr_thread + 54
Thread 3:: CVDisplayLink
0 libsystem_kernel.dylib 0x00007fff8404a0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8c8bffb9 _pthread_cond_wait + 869
2 com.apple.CoreVideo 0x00007fff8761b2a1 CVDisplayLink::runIOThread() + 689
3 com.apple.CoreVideo 0x00007fff8761afd7 startIOThread(void*) + 148
4 libsystem_c.dylib 0x00007fff8c8bb772 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8c8a81a1 thread_start + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fc1a0434f90 rbx: 0x0000000000000000 rcx: 0xffff803e5fbcafaf rdx: 0x00007fff8c840ef2
rdi: 0x0000000000000000 rsi: 0x00007fc1a0434f90 rbp: 0x00007fff5e317000 rsp: 0x00007fff5e316f58
r8: 0xffff803e5fbcafaf r9: 0x00000000000000ff r10: 0x00007fc1a100ec00 r11: 0x0000000005d414ad
r12: 0x00007fff8602d360 r13: 0x00007fc1a0435050 r14: 0x00007fc1a0435050 r15: 0x00007fff8602df50
rip: 0x00007fff8c83dc28 rfl: 0x0000000000010206 cr2: 0x0000000000000038
Logical CPU: 0
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 2
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 28757
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=187.9M resident=78.8M(42%) swapped_out_or_unallocated=109.1M(58%)
Writable regions: Total=155.6M written=3596K(2%) resident=14.4M(9%) swapped_out=0K(0%) unallocated=141.2M(91%)
REGION TYPE VIRTUAL
=========== =======
CG backing stores 2280K
CG image 4K
CG raster data 56K
CG shared images 1184K
CoreAnimation 44K
CoreImage 4K
CoreServices 1724K
IOKit 4476K
IOKit (reserved) 4K reserved VM address space (unallocated)
MALLOC 114.6M
MALLOC guard page 48K
Memory tag=240 4K
Memory tag=242 12K
Memory tag=251 8K
OpenCL 8K
OpenGL GLSL 1936K
OpenGL GLSL (reserved) 128K reserved VM address space (unallocated)
SQLite page cache 96K
STACK GUARD 56.0M
Stack 9752K
VM_ALLOCATE 16.2M
__DATA 37.2M
__IMAGE 528K
__LINKEDIT 54.5M
__TEXT 133.4M
__UNICODE 544K
mapped file 41.9M
shared memory 372K
=========== =======
TOTAL 476.4M
TOTAL, minus reserved VM space 476.3M
这是我认为会破坏应用程序的实际代码。
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
unsigned long __block current = 0;
unsigned long total = 0;
dispatch_sync(dispatch_get_main_queue(), ^{
_fileOperation = YES;
[_fileCopyProgress setHidden:NO];
[_fileCopyProgress startAnimation:self];
[_processString setStringValue:@"Scanning..."];
[_processString setHidden:NO];
});
for (NSURL* url in pboardObjects) {
[self scanFileURLSForImport:url];
}
total = _mediaFileURLSForImport.count;
[self updateImportProcess:current of:total];
[_processString setStringValue:@"Importing..."];
for (NSURL* url in _mediaFileURLSForImport) {
[self performSelectorOnMainThread:@selector(createVideo_2:) withObject:url waitUntilDone:YES];
[self updateImportProcess:(++current) of:total];
}
[self performSelectorOnMainThread:@selector(saveAction:) withObject:nil waitUntilDone:YES];
[_tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(selectImportedFiles:) withObject:nil waitUntilDone:YES];
dispatch_sync(dispatch_get_main_queue(), ^{
_fileOperation = NO;
[_processString setStringValue:@""];
[_processString setHidden:YES];
[_fileCopyProgress setHidden:YES];
[_fileCopyProgress stopAnimation:self];
});
});
为了增加一点点扭曲,这次崩溃在我的测试机器上没有发生,一切都在那里完美运行,应用程序被提交到应用程序商店并被苹果批准,这意味着它在常规和来宾帐户。但昨天它在同事机器上每次都崩溃了。我唯一想要解决的就是他的机器报告。我无法在我的测试机器上复制它,一切都在那里工作。
答案 0 :(得分:2)
Symbolicate您的崩溃报告。之后,您将看到堆栈的一部分,其中包含崩溃中涉及的代码。
1 com.larod.mavi 0x00000001018f6e12 0x1018e7000 + 65042
答案 1 :(得分:0)
挂起lldb并设置异常断点以在崩溃的地方中断,并检查lldb中的bt命令堆栈跟踪。通常,通过写入只能读取的内存或者您正在访问已解除分配的对象,您会导致内存崩溃。从日志中,我假设您正在拖动视图并执行某些操作,您确定相关视图在块中仍然有效吗?所有视图都应该在主线程上,并且仍然在内存中有效