gpt4 book ai didi

ios - FontAwesomeKit - 'NSInvalidArgumentException' iOS 7.1.1

转载 作者:行者123 更新时间:2023-11-28 22:07:33 24 4
gpt4 key购买 nike

我正在为我的新 iOS 应用程序使用很酷的库 FontAwesomeKit ( https://github.com/PrideChung/FontAwesomeKit )。但是我遇到了一个奇怪的异常,它只在 Release模式和我的 iOS 7.1.1 iPhone 上抛出。

看起来像:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: 'NSConcreteMutableAttributedString addAttribute:value:range:: nil value'

当我在模拟器(DEBUG 和 RELEASE)和 iPhone(DEBUG)中测试时一切正常,iPhone(RELEASE)崩溃。

此解决方法没有帮助 - https://github.com/PrideChung/FontAwesomeKit/blob/master/KnownIssues.md

谢谢!

更新

问题出在我的代码和__weak 引用:

__weak UIColor *menuColor = [UIColor colorWithHexString:@"#636577"];
__weak UIColor *menuColorHover = [UIColor colorWithHexString:@"#3D3F52"];
CGFloat icon_size = 25.5f;

for (UIButton *button in self.buttons) {
if ([button.titleLabel.text isEqualToString:@"Feed"]) {
FAKFoundationIcons *feedIcon = [FAKFoundationIcons homeIconWithSize:icon_size];

[feedIcon addAttribute:NSForegroundColorAttributeName value:menuColor];
[button setImage:[feedIcon imageWithSize:CGSizeMake(icon_size, icon_size)] forState:UIControlStateNormal];

[feedIcon addAttribute:NSForegroundColorAttributeName value:menuColorHover];
[button setImage:[feedIcon imageWithSize:CGSizeMake(icon_size, icon_size)] forState:UIControlStateHighlighted];
}

最佳答案

那里不需要__weak

正如您在评论中所说,它在调试版本中工作,因为没有进行任何优化,但在发布版本中,编译器决定优化掉弱引用,留下 nil 作为争论。

只要去掉不必要的 __weak 修饰符就可以了。

关于ios - FontAwesomeKit - 'NSInvalidArgumentException' iOS 7.1.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23583431/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com