libc++abi.dylib: terminate_handler unexpectedly threw an exception修复

来源:互联网 发布:淘宝店主在哪进货 编辑:程序博客网 时间:2024/06/08 02:24

代码如下

NSMutableAttributedString *attributedString1 = [[NSMutableAttributedString alloc]initWithString:Label.text];[attributedString1 addAttribute:NSForegroundColorAttributeName value:BuleTextColor range:NSMakeRange(020)];Label.attributedText = attributedString1;

真机运行后全局断点断在了 [attributedString1 addAttribute:NSForegroundColorAttributeName value:BuleTextColor range:NSMakeRange(0,20)];这句代码

报错原因是:range长度越界
解决办法:检查Label.text的长度是否达到20

0 0
原创粉丝点击