3中的NSMutableAttributedString崩溃

3中的NSMutableAttributedString崩溃

本文介绍了iOS 7.0.3中的NSMutableAttributedString崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天后,我发生了崩溃,只发生在iOS中,代码如下:

Since a few days, I have a crash that only happens in iOS with the following line of code

[myAttributedString addAttribute:NSFontAttributeName
                                             value:[UIFont fontWithName:@"HelveticaNeue-Italic" size:myLabel.font.pointSize]
                                             range:rangeOfSubString];

调试器给出的原因是

由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'NSConcreteMutableAttributedString addAttribute:value:range :: nil value'
例外类型:SIGABRT

"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSConcreteMutableAttributedString addAttribute:value:range:: nil value'"Exception Type: SIGABRT

I从文档中知道它的价值是零。知道为什么[UIFont fontWithName:@HelveticaNeue-Italicsize:myLabel.font.pointSize]会在iOS 7.0.3中返回nil吗? (它在iOS 7.0.2中运行得非常好)

I know from the documentation that it's the value that's nil. Any idea why [UIFont fontWithName:@"HelveticaNeue-Italic" size:myLabel.font.pointSize] would return nil in iOS 7.0.3? (it was working perfectly well in iOS 7.0.2)

推荐答案

Helvetica neue的字体似乎不见了

That typeface of Helvetica neue seems to be missing

这篇关于iOS 7.0.3中的NSMutableAttributedString崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 13:32