libc++abilibc .dylib 添加0x36ddc04a 0x36dc4

libc++abi.dylib: terminate_handler unexpectedly threw an exception错误 - 简书
下载简书移动应用
写了18127字,被266人关注,获得了221个喜欢
libc++abi.dylib: terminate_handler unexpectedly threw an exception错误
最近做长按消息气泡弹出menuController删除消息cell功能遇到个错误,libc++abi.dylib: terminate_handler unexpectedly threw an exception,这个异常没有打印日志,也无法定位到具体问题。网络找到这段代码打印出异常:
//问题代码
[self.dataArray removeObjectAtIndex:1];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
@catch (NSException *exception) {
NSLog(@"exception = %@", exception);
@finally {
输出结果:
exception = Attempt to delete row containing first responder that refused to resign
看到这句话大概知道原因了,弹出menuController需要设置becomeFirstResponder成为第一响应者,删除cell之前则需要resignFirstResponder
删除cell之前加上这段代码就好使了:
MessageCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
[cell.messageView resignFirstResponder];
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
选择支付方式:主题 : 大虾进来帮帮忙libc++abi.dylib: terminate_handler unexpectedly threw an exception
级别: 新手上路
UID: 348754
可可豆: 19 CB
威望: 12 点
在线时间: 82(时)
发自: Web Page
来源于&&分类
大虾进来帮帮忙libc++abi.dylib: terminate_handler unexpectedly threw an exception&&&
如题:libc++abi.dylib: terminate_handler unexpectedly threw an exception打印的堆栈信息:(lldb) bt* thread #1: tid = 0x3aff3, 0x36447df0 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT    frame #0: 0x36447df0 libsystem_kernel.dylib`__pthread_kill + 8    frame #1: 0x364c5cc6 libsystem_pthread.dylib`pthread_kill + 62    frame #2: 0x363e3908 libsystem_c.dylib`abort + 76    frame #3: 0x libc++abi.dylib`abort_message + 88    frame #4: 0x35728e28 libc++abi.dylib`std::__terminate(void (*)()) + 148    frame #5: 0x libc++abi.dylib`__cxa_throw + 112    frame #6: 0x35df1d5e libobjc.A.dylib`objc_exception_throw + 250    frame #7: 0x2b4fe286 UIKit`-[UINavigationController pushViewController:transition:forceImmediate:] + 1714    frame #8: 0x2b76bef8 UIKit`__54-[UINavigationController pushViewController:animated:]_block_invoke + 356    frame #9: 0x2b4fdbc4 UIKit`-[UINavigationController pushViewController:animated:] + 496    frame #10: 0x2b55fa78 UIKit`-[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 168    frame #11: 0x2b589260 UIKit`-[_UIViewControllerTransitionContext _runAlongsideCompletions] + 116    frame #12: 0x2b588248 UIKit`-[_UIViewControllerTransitionContext completeTransition:] + 120    frame #13: 0x2b6d4b8c UIKit`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke93 + 524    frame #14: 0x2b4abd5c UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 308    frame #15: 0x2b4ab974 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184    frame #16: 0x2b4ab886 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 66    frame #17: 0x2aea2100 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 236    frame #18: 0x00b9615e libdispatch.dylib`_dispatch_client_callout + 22    frame #19: 0x00b99e44 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1512    frame #20: 0x27f21618 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8    frame #21: 0x27f1fd18 CoreFoundation`__CFRunLoopRun + 1512    frame #22: 0x27e6d3b0 CoreFoundation`CFRunLoopRunSpecific + 476    frame #23: 0x27e6d1c2 CoreFoundation`CFRunLoopRunInMode + 106    frame #24: 0x2f49a200 GraphicsServices`GSEventRunModal + 136    frame #25: 0x2b4d743c UIKit`UIApplicationMain + 1440搞了两天了都没搞定悲剧啊!!!!求组
级别: 新手上路
可可豆: 7 CB
威望: 7 点
在线时间: 622(时)
发自: Web Page
同求啊&& 这倒是什么原因啊
级别: 新手上路
UID: 348754
可可豆: 19 CB
威望: 12 点
在线时间: 82(时)
发自: Web Page
关注本帖(如果有新回复会站内信通知您)
3*3+1 正确答案:10
发帖、回帖都会得到可观的积分奖励。
按"Ctrl+Enter"直接提交
关注CocoaChina
关注微信 每日推荐
扫一扫 浏览移动版在开发中出现了这个错误,断点查找很久,没找到问题所在的代码,google下,发现了下面这几点会产生这个错误:
首先,顾名思义,错误原因是我们在调用某个方法的时候,传入了一个空字符串(注意区别于字符串内容为空)作为方法参数。
对某一个空数组使用objectAtIndex方法。不会报数组越界的错,而是NSScanner: nil string argument。
经过检查,我代码中如果字符串赋值,我一般都对nil做了一定处理,用@""代替,也未有数组越界,但是还是报这样的错误。
现在的信息点是libc++abi.dylib,这个库到底是做什么的?从后缀看,是一个动态库,那么会不会是因为发生了一些动态错误?而按经验来看,一般的动态错误基本是因为动态类型错误引起,在object-c语言中,会发生动态类型错误的可能基本存在于不可变类型与可变类型之间的转换,那么我们的查错范围将优先限制在不可变类型与可变类型转换上,是否我们对一个不可变类型进行了修改操作?当然,编译器没有那么傻,如果直接对一个不可变类型进行修改操作,是会直接报错的,那么就剩下另一种可能,程序将一个不可变类型赋值给可变类型,然后对可变类型进行了修改操作,这样可以通过静态检查,但是动态运行的时候,就会发生类型错误。基于以上分析,我们可以跟踪断点,会发现程序在对mutable对象进行add、set等操作时挂掉,而这个对象实际上赋值的是一个不可变对象。常见的情况是把一个NSArray对象赋值给一个NSMutableArray对象,然后进行了delete、add等修改操作,或者把一个NSDictionary对象赋值给一个NSMutableDictionary对象,然后进行了set等操作。
这是从http://www.itnose.net/detail/6196671.html里面得来的方案,经过排查,代码表面上也未有这样的错误。
然后找到最后崩溃处的断点代码如下:
NSDictionary *orderDict = [notification userInfo];
self.selectedOrderDict = orderD
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.selectedRow inSection:0];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:@[indexPath], nil] withRowAnimation:UITableViewRowAnimationNone];
&灵机一动,其实是实在不知道怎么改了,于是改成了下面的代码,然后编译,运行,既然可以了。。。。。。
NSDictionary *orderDict = [notification userInfo];
self.selectedOrderDict = orderD
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.selectedRow inSection:0];
NSMutableArray *tmpArray = [NSMutableArray array];
[tmpArray addObject:indexPath];
[self.tableView reloadRowsAtIndexPaths:tmpArray withRowAnimation:UITableViewRowAnimationNone];
&不解,既然这样就可以了,可是从代码层次、逻辑层次来说,这两种写法应该是一样的,难道是这个借口需要的是可变的数组?于是打开里面的接口,发现是这样的:
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation NS_AVAILABLE_IOS(3_0);
&当时我的心情是崩溃的,尼玛,那啥意思,于是有了下面的测试:
NSDictionary *orderDict = [notification userInfo];
self.selectedOrderDict = orderD
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.selectedRow inSection:0];
NSMutableArray *tmpArray = [NSMutableArray array];
[tmpArray addObject:indexPath];
[self.tableView reloadRowsAtIndexPaths:tmpArray withRowAnimation:UITableViewRowAnimationNone];
NSArray *tmpArray = @[indexPath];
[self.tableView reloadRowsAtIndexPaths:tmpArray withRowAnimation:UITableViewRowAnimationNone];
&这样也是不崩溃的......
好吧,到这,还是没发现错误原因,然后回去仔细看看面前的代码,发现
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.selectedRow inSection:0];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:@[indexPath], nil] withRowAnimation:UITableViewRowAnimationNone];
&indexPath本身就是个对象了,而我还用NSValues包装它,放进去,肯定不能解析而崩溃啊......
阅读(...) 评论()iOS 报错:!!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index
libc++abi.dylib: termi
出现的场景:
UITextView限制输入的字数
- (void)textViewDidChange:(UITextView *)textView {if (textView.text.length == 0) {
_placeHolderLab.hidden = NO;}else{
_placeHolderLab.hidden = YES;}if (textView.text.length &= 10) {
NSString *str= [textView.text substringToIndex:10];
textView.text =}} 复现场景:
if (textView.text.length &= 10) 判断就会崩溃,当然也不是什么机器都崩溃的,当时测试给出的机器是
系统 7.1.0 自己测试
7以上的系统没有问题,并且在
系统 7.1.0 的机器上输入纯英文,纯数字是没有问题的,只有输入中文才会崩溃。解决办法:
- (void)textViewDidChange:(UITextView *)textView {if (textView.text.length == 0) {
_placeHolderLab.hidden = NO;}else{
_placeHolderLab.hidden = YES;}if (textView.text.length &= 10) {
NSString *str= [textView.text substringToIndex:10];
dispatch_async(dispatch_get_main_queue(), ^{
textView.text =
});}}更新UI在主线程中更新
最新教程周点击榜
微信扫一扫I'm creating my first app, so this may be something silly!
Anyway, When building and running on iOS simulator, the app starts, but jams on the loading screen, and on the console, I get this -
libc++abi.dylib: terminating with uncaught exception of type NSException
Can anyone point out to any solutions?
Here's the whole error.
20:56:55.429 4Pics1Meaning[6] * Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFString characterAtIndex:]: Range or index out of bounds'
* First throw call stack:
CoreFoundation
0x3c65 exceptionPreprocess + 165
libobjc.A.dylib
0xd11bb7 objc_exception_throw + 45
CoreFoundation
0x3b9d +[NSException raise:format:] + 205
CoreFoundation
0x5cd6 -[__NSCFString characterAtIndex:] + 102
4Pics1Meaning
0x5037 -[RFViewController PopulateButtonLetters] + 2439
4Pics1Meaning
0x1732 -[RFViewController viewDidLoad] + 3858
0xd0210 -[UIViewController loadViewIfRequired] + 738
0xd040e -[UIViewController view] + 27
0xeb2c9 -[UIWindow addRootViewControllerViewIfPossible] + 58
0xeb68f -[UIWindow _setHidden:forced:] + 247
0xf7e21 -[UIWindow makeKeyAndVisible] + 42
0xb457 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
0xe1de -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
0xd0d5 -[UIApplication workspaceDidEndTransaction:] + 179
FrontBoardServices
0xa485e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
CoreFoundation
0x741c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12
CoreFoundation
0xd165 __CFRunLoopDoBlocks + 341
CoreFoundation
0xc923 __CFRunLoopRun + 851
CoreFoundation
0xc366 CFRunLoopRunSpecific + 470
0xcb42 -[UIApplication _run] + 413
0xf900 UIApplicationMain + 1282
4Pics1Meaning
0x02af main + 111
libdyld.dylib
0xc145 start + 1
libc++abi.dylib: terminating with uncaught exception of type NSException
Related posts
Recent Viewed
Blog Search}

我要回帖

更多关于 libc abi.dylib 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信