我根据此崩溃报告在哪里开始查看?

时间:2012-11-09 15:24:08

标签: ios exc-bad-access crash-reports

我仍然是崩溃报告分析的新手,可以使用一些帮助来追踪我的问题。以下是相关报告的一部分。

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

所以,我认为我没有在生产中传递零。但是,这是否意味着我的指针指向已重写但不再代表原始数据的内存?

1 个答案:

答案 0 :(得分:5)

您可能已经解决了这个问题,但我收到了相同的崩溃报告,并意识到我试图在无效坐标上添加注释。我的数据源(返回JSON的API)给了我一个无效的纬度值。

我修改了这段代码:

    //add the Station object to the array
    [stations addObject:tempStation]; // <--(this eventually calls [MKMapView addAnnotation:])

......加入此保护措施:

    if (CLLocationCoordinate2DIsValid(tempStation.coordinate))
    {
        //add the Station object to the array if its coordinate is valid
        [stations addObject:tempStation];
    }
    else
    {
        //otherwise just log an error and go to the next station
        NSLog("Invalid station coordinate: stationID %d, %@, coord %f, %f", tempStation.stationID, tempStation.name, tempStation.latitude, tempStation.longitude);
    }

下次运行代码时,我收到了这个日志:

Invalid station coordinate: stationID 311, 14th St & Colorado Ave NW, coord -1345.707008, -77.032947

忽略了无效数据,并且崩溃停止了。