iOS libc++abi.dylib: handler threw exception 错误的解决方案
简单说下背景:最近把工具和SDK都进行了升级Xcode4.5和iOS6,无意之中测出了一个
必现的bug : libc++abi.dylib: handler threw exception。
libc++abi.dylib: handler threw exception
: pop {r4, r5}
以为是升级Xcode或者测试手机(iOS6)而引起的问题,但是仔细查看却不是。
找到错误日志:
*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds for empty array (null) ( 0 CoreFoundation 0x3867b2bb <redacted> + 186 1 libobjc.A.dylib 0x351c797f objc_exception_throw + 30 2 CoreFoundation 0x385c6b75 <redacted> + 164 3 vTurning 0x0003d18b -[PopularWRController tableView:cellForRowAtIndexPath:] + 462 4 UIKit 0x34acb54d <redacted> + 412 5 UIKit 0x34ab0313 <redacted> + 1310 6 UIKit 0x34ac9c4d <redacted> + 168 7 UIKit 0x34aea9a3 <redacted> + 482 8 UIKit 0x34af0f39 <redacted> + 224 9 UIKit 0x34aa27fd <redacted> + 556 10 UIKit 0x34aa2357 <redacted> + 330 11 UIKit 0x34aa219b <redacted> + 1474 12 UIKit 0x34aed405 <redacted> + 156 13 UIKit 0x34af0a81 <redacted> + 224 14 vTurning 0x0002b82b -[EGORefreshTableHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:] + 186 15 vTurning 0x0003e23d -[PopularWRController finishLoadingTableViewData] + 772 16 Foundation 0x32aaba6f <redacted> + 450 17 CoreFoundation 0x386505df <redacted> + 14 18 CoreFoundation 0x38650291 <redacted> + 272 19 CoreFoundation 0x3864ef01 <redacted> + 1232 20 CoreFoundation 0x385c1ebd CFRunLoopRunSpecific + 356 21 CoreFoundation 0x385c1d49 CFRunLoopRunInMode + 104 22 GraphicsServices 0x38c5e2eb GSEventRunModal + 74 23 UIKit 0x34ad4301 UIApplicationMain + 1120 24 vTurning 0x0001e5a1 main + 100 25 vTurning 0x0001e538 start + 40 )
发现是数组越界引起的问题,仔细查看是
EGORefreshTableHeaderView,在重新加载数据的时候,把之前的数据清理掉了,重新reload的时候出错。
问题已经定位了,后面就很好解决了。
最近发现了一些之前没有出现的问题bug,总以为是SDK的问题,总的来说自己要进行定位,不依赖于工具。