您的位置:首页 > 产品设计 > UI/UE

关于Xcode6:[UICTFont _scaledValueForValue:] Crash问题的解决方法

2015-11-18 15:02 204 查看
最近用Xcode6编译了一下以前的一个项目,突然发现在xcode6编译运行,马上机会Crash。

2014-09-16 14:14:15.303 *** Assertion failure in -[UICTFont _scaledValueForValue:], /SourceCache/UIFoundation_Sim/UIFoundation-371/UIFoundation/iOS/UIFont.m:

如果你的项目中存在类似的代码:

[UIFont fontWithName:@"HiraKakuProN-W3" size:10]


[UIFontfontWithName:@"HiraKakuProN-W3"size:10]
估计在xcode6的环境下编译会马上就会Crash掉,我的解决方法如下:

[UIFont fontWithDescriptor:[UIFontDescriptor fontDescriptorWithFontAttributes:@{@"NSCTFontUIUsageAttribute" : UIFontTextStyleBody,@"NSFontNameAttribute" : @"HiraKakuProN-W3"}] size:10.0]


[UIFontfontWithDescriptor:[UIFontDescriptorfontDescriptorWithFontAttributes:@{@"NSCTFontUIUsageAttribute":UIFontTextStyleBody,@"NSFontNameAttribute":@"HiraKakuProN-W3"}]size:10.0]
替换成如上的方法就会顺利的编译通过。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: