gpt4 book ai didi

ios - 崩溃 sizeWithAttributes

转载 作者:行者123 更新时间:2023-11-29 10:52:13 27 4
gpt4 key购买 nike

<分区>

我的字典的一个参数看起来是零,但我不知道为什么......我浏览了 SOF,所有的命题都是这样的。

CGSize size;
if ([[[UIDevice currentDevice] systemVersion]
compare:@"7.0" options:NSNumericSearch] == NSOrderedAscending) {
// here it works
size = [string sizeWithFont:[UIFont fontWithName:@"HelveticaNeue-Italic"
size:15.0f]];
} else {
// here it crashes
size = [string sizeWithAttributes:
[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"HelveticaNeue-Italic"
size:15.0f] forKey:NSFontAttributeName]];
}

//控制台输出

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]:
attempt to insert nil object from objects[0]'

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