我还不太了解崩溃报告分析,需要帮助找到问题所在。以下是相关报告的部分内容。
Incident Identifier: 5D510334-3888-40A6-A7C1-5AE1109BFDD4
CrashReporter Key: b4cfc1c63d61ef3f17a53e0732f05ad768cad375
Hardware Model: iPhone4,1
Process: WxT [1263]
Path: /var/mobile/Applications/E7B24747-F168-4E23-99F9-89DC23A8531C/WxT.app/WxT
Identifier: WxT
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-11-07 21:35:25.723 -0600
OS Version: iOS 6.0.1 (10A523)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000020
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MapKit 0x318325d2 _contains(objc_object*, MKQuadTrieNode*) + 10
1 MapKit 0x318325c0 -[MKQuadTrie contains:] + 20
2 MapKit 0x3184411c -[MKAnnotationContainerView addAnnotation:] + 264
3 MapKit 0x3185645e -[MKMapView addAnnotation:] + 46
4 WxT 0x0009b654 -[RadarViewController dProc2addLocalStormReports] (RadarViewController.m:6234)
5 WxT 0x00093040 -[RadarViewController download:didFinishWithData:processObject:forStation:] (RadarViewController.m:2519)
6 WxT 0x000a67b8 -[DownloadManager connectionDidFinishLoading:] (DownloadManager.m:185)
7 Foundation 0x3436def2 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 14
8 Foundation 0x342ad9ec -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
9 Foundation 0x342ad908 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
10 CFNetwork 0x370945dc ___delegate_didFinishLoading_block_invoke_0 + 24
11 CFNetwork 0x37093cc8 ___withDelegateAsync_block_invoke_0 + 52
12 CFNetwork 0x370bc130 ___performAsync_block_invoke_068 + 16
13 CoreFoundation 0x3948b74a CFArrayApplyFunction + 174
14 CFNetwork 0x370bc58e RunloopBlockContext::perform() + 70
15 CFNetwork 0x3702015a MultiplexerSource::perform() + 186
16 CoreFoundation 0x3951a680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
17 CoreFoundation 0x39519ee4 __CFRunLoopDoSources0 + 208
18 CoreFoundation 0x39518cb2 __CFRunLoopRun + 642
19 CoreFoundation 0x3948beb8 CFRunLoopRunSpecific + 352
20 CoreFoundation 0x3948bd44 CFRunLoopRunInMode + 100
21 GraphicsServices 0x378592e6 GSEventRunModal + 70
22 UIKit 0x326cb2f4 UIApplicationMain + 1116
23 WxT 0x0008c626 main (main.m:14)
24 WxT 0x0008c5e0 start + 36
我认为这段话想表达的是:
(1) 调用了一个MapKit函数,但它期望引用一个已经被释放的内存区域。Thread0, item0: _contains(objc_object*, MKQuadTrieNode*)
(2) 我的代码在不应该释放内存的时候却释放了它。
(3) 导致问题的代码部分在Thread0下的4、5和6项中提到。
我理解得对吗?接下来我该怎么做呢?
编辑:在阅读了第一条评论后,我尝试将nil传递给addAnnotation:以模拟此问题。当故意传递nil时,我得到了不同的异常类型和代码。以下是导致崩溃的报告结果:
Incident Identifier: 2BC5BEB8-6295-44A1-9235-26AE060C571A
CrashReporter Key: b4cfc1c63d61ef3f17a53e0732f05ad768cad375
Hardware Model: iPhone4,1
Process: WxT Pro [2689]
Path: /var/mobile/Applications/3AE2A909-C6E5-421A-BEE9-6DCAFEAE40B6/WxT Pro.app/WxT Pro
Identifier: WxT Pro
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: debugserver [2687]
Date/Time: 2012-11-09 12:55:11.457 -0600
OS Version: iOS 6.0.1 (10A523)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3954529e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3343497a objc_exception_throw + 26
2 CoreFoundation 0x3949d2fa -[__NSSetM addObject:] + 582
3 MapKit 0x31844166 -[MKAnnotationContainerView addAnnotation:] + 338
4 MapKit 0x3185645e -[MKMapView addAnnotation:] + 46
5 WxT Pro 0x000b055c -[RadarViewController dProc2addLocalStormReports] (RadarViewController.m:6574)
6 WxT Pro 0x000af31a -[RadarViewController dProc2processLocalStormReportListDownload:] (RadarViewController.m:6234)
7 WxT Pro 0x000a2bfc -[RadarViewController download:didFinishWithData:processObject:forStation:] (RadarViewController.m:2721)
8 WxT Pro 0x000c3e36 -[DownloadManager connectionDidFinishLoading:] (DownloadManager.m:185)
9 Foundation 0x3436def0 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 12
10 Foundation 0x342ad9ec -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
11 Foundation 0x342ad908 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
12 CFNetwork 0x370945da ___delegate_didFinishLoading_block_invoke_0 + 22
13 CFNetwork 0x37093cc6 ___withDelegateAsync_block_invoke_0 + 50
14 CFNetwork 0x370bc12e ___performAsync_block_invoke_068 + 14
15 CoreFoundation 0x3948b748 CFArrayApplyFunction + 172
16 CFNetwork 0x370bc58e RunloopBlockContext::perform() + 70
17 CFNetwork 0x37020158 MultiplexerSource::perform() + 184
18 CoreFoundation 0x3951a67e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10
19 CoreFoundation 0x39519f7a __CFRunLoopDoSources0 + 358
20 CoreFoundation 0x39518cb2 __CFRunLoopRun + 642
21 CoreFoundation 0x3948beb8 CFRunLoopRunSpecific + 352
22 CoreFoundation 0x3948bd44 CFRunLoopRunInMode + 100
23 GraphicsServices 0x378592e6 GSEventRunModal + 70
24 UIKit 0x326cb2f4 UIApplicationMain + 1116
25 WxT Pro 0x00096f36 main (main.m:14)
26 WxT Pro 0x00096edc start + 36
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3123b350 __pthread_kill + 8
1 libsystem_c.dylib 0x345ca11e pthread_kill + 54
2 libsystem_c.dylib 0x3460696e abort + 90
3 libc++abi.dylib 0x37726d4a abort_message + 70
4 libc++abi.dylib 0x37723ff4 _ZL17default_terminatev + 20
5 libobjc.A.dylib 0x33434a74 _ZL15_objc_terminatev + 144
6 libc++abi.dylib 0x37724078 _ZL19safe_handler_callerPFvvE + 76
7 libc++abi.dylib 0x37724110 std::terminate() + 16
8 libc++abi.dylib 0x37725594 __cxa_rethrow + 84
9 libobjc.A.dylib 0x334349cc objc_exception_rethrow + 8
10 CoreFoundation 0x3948bf1c CFRunLoopRunSpecific + 452
11 CoreFoundation 0x3948bd44 CFRunLoopRunInMode + 100
12 GraphicsServices 0x378592e6 GSEventRunModal + 70
13 UIKit 0x326cb2f4 UIApplicationMain + 1116
14 WxT Pro 0x00096f36 main (main.m:14)
15 WxT Pro 0x00096edc start + 36
因此,我假设在生产环境中没有传递nil。但是,这是否意味着我的指针指向的内存已被重写,不再代表原始数据?
nil
传递给addAnnotation:
,或者你正在使用一个nil
值并向其传递偏移量以进行addAnnotation:
。根据地址(0x20
)来看,似乎更像是前者。 - JustSid