iOS - libc++abi.dylib: terminate_handler unexpectedly threw an exception
代码出现crash,报错:libc++abi.dylib: terminate_handler unexpectedly threw an exception
当我们很明确是某一块代码执行导致了错误,不妨使用try catch来打印exception详情。
例如:
@try {
self.headerlineLable.text = [_entity.name substringToIndex:]?:@"Power by Wieye";
self.headerlineLable.font = Font_Heiti(kCF_TAB);
}
@catch (NSException *exception) {
NSLog(@"exception:%@",exception);
}
打印结果:
exception:*** -[__NSCFString substringToIndex:]: Index
我们知道了问题,问题是因为我想保留字符串前16个索引,但现在传递过来的字符串是13个索引。索引越界了。然后崩溃了~
今天是1月26日,出现了这样的错误,我需要重新编辑一下处理方法:
libc++abi.dylib: terminate_handler unexpectedly threw an exception
分析摘自:http://www.itnose.net/detail/6196671.html
现在唯一的信息点是libc++abi.dylib,这个库到底是做什么的?从后缀看,是一个动态库,那么会不会是因为发生了一些动态错误? 而按经验来看,一般的动态错误基本是因为动态类型错误引起,在object-c语言中,会发生动态类型错误的可能基本存在于不可变类型与可变类型之间的转换,那么我们的查错范围将优先限制在不可变类型与可变类型转换上,是否我们对一个不可变类型进行了修改操作?当然,编译器没有那么傻,如果直接对一个不可变类型进行修改操作,是会直接报错的,那么就剩下另一种可能,程序将一个不可变类型赋值给可变类型,然后对可变类型进行了修改操作,这样可以通过静态检查,但是动态运行的时候,就会发生类型错误。基于以上分析,我们可以跟踪断点,会发现程序在对mutable对象进行add、set等操作时挂掉,而这个对象实际上赋值的是一个不可变对象。常见的情况是把一个NSArray对象赋值给一个NSMutableArray对象,然后进行了delete、add等修改操作,或者把一个NSDictionary对象赋值给一个NSMutableDictionary对象,然后进行了set等操作。
提示:如果出现这样的问题,大都是数组越界之类的。
iOS - libc++abi.dylib: terminate_handler unexpectedly threw an exception的更多相关文章
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误小结
说法一: 我们在运行xcode工程时,有时候会遇到”libc++abi.dylib: terminate_handler unexpectedly threw an exception”错误,app莫 ...
- 【iOS】libc++abi.dylib: terminate_handler unexpectedly threw an exception
用 ShareSDK 做第三方分享的时候遇到了这个问题…… 联系了客服,后来在他的指导下,发现是数组的问题,该问题不知道是否具有通用性,暂且记下.
- libc abi.dylib: terminate_handler unexpectedly threw an exception
错误代码:很明显的错误,一定要谨记. - (NSInteger)giftCountFullScreen{ NSArray *arr = [NSMutableArray arrayWithArray:s ...
- 如何调试libc++abi.dylib handler threw exception错误
From:http://blog.csdn.net/naruto_ku/article/details/8779203 在进行iOS开发时,偶尔会碰到libc++abi.dylib handler t ...
- libc++abi.dylib handler threw exception
在iOS开发时,有时候遇到libc++abi.dylib handler threw exception这样的异常, 虽然在断点出加上了All Exceptions,也断到相应的代码了,但是没打印对 ...
- IOS Exception 1(libc++abi.dylib: terminating with uncaught exception of type NSException)
2014-08-05 22:18:46.455 SwiftUI[1329:40871] -[_TtC7SwiftUI14MViewControler clickMe]: unrecognized se ...
- mac python3 conda pytorch出错:libc++abi.dylib: terminating with uncaught exception of type NSException
mac 10.14/ conda/python 3.7环境下运行神经网络例子出现错误: -- :::] -[NSApplication _setup:]: unrecognized selector ...
- 综合出现NSScanner: nil string argument libc++abi.dylib: terminat错误的解决方案
在开发中出现了这个错误,断点查找很久,没找到问题所在的代码,google下,发现了下面这几点会产生这个错误: 首先,顾名思义,错误原因是我们在调用某个方法的时候,传入了一个空字符串(注意区别于字符串内 ...
- libc++abi.dylib`__cxa_throw: 使用[AVAudioPlayer play]会产生__cxa_throw异常
libc++abi.dylib`__cxa_throw: 使用[AVAudioPlayer play]会产生__cxa_throw异常 开发中遇到一个奇怪的异常.我调用AVAudioPlayer pl ...
随机推荐
- 「拉勾网」薪资调查的小爬虫,并将抓取结果保存到excel中
学习Python也有一段时间了,各种理论知识大体上也算略知一二了,今天就进入实战演练:通过Python来编写一个拉勾网薪资调查的小爬虫. 第一步:分析网站的请求过程 我们在查看拉勾网上的招聘信息的时候 ...
- fstab 中 通过UUID挂载 参数解释
UUID=cf474122-1d51-4953-846d-9ce1c8d23ae6 / ext4 defaults 1 1UUID=ef21d494-0dc7-41ec-95b2-a691bfd4e5 ...
- nios II--实验1——hello_world软件部分
hello_world 软件开发 首先,在硬件工程文件夹里面新建一个software的文件夹用于放置软件部分:打开toolsàNios II 11.0 Software Build Tools for ...
- OpenFlow
What is OpenFlow? OpenFlow is an open standard that enables researchers to run experimental protocol ...
- Predicting purchase behavior from social media-www2013
1.Information publication:www2013 author:Yongzheng Zhang 2.What 用社交媒体用户特征 预测用户购买商品类别(排序问题) 3.Dataset ...
- Ubuntu里的若干问题解决方案
1. Ubuntu里出现两个屏幕,并且其中一个是“未知显示器”,无法去除时,可以尝试使用该命令:sudo apt-get install bumblebee-nvidia 2.虚拟机上Ubuntu开机 ...
- 强连通 HDU 1269
n点m边 求是否能从任意a->b b->a 强连通分量等于1 #include<stdio.h> #include<algorithm> #include<s ...
- jquery.ui.widget详解
案例详解 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <titl ...
- SSD固态硬盘的闪存芯片颗粒介绍
固态硬盘凭借其存取速率超快等自身优势,被越来越多的电脑爱好者所青睐,并迅速普及到了广大用户的电脑中,因为固态硬盘与传统机械硬盘相比,确实在运行效率等方面有了质的提升,这里先了解一些评判固态硬盘优劣的知 ...
- 关于Yii2中CSS,JS文件的引入心得
js和css的引入 use yii\helpers\Html; 1.全局引入,所有的view生效 /assets/AppAsset.php public $css = [ 'css/site.css' ...