gpt4 book ai didi

ios - NSCFConstantString objectAtIndex : error in grouped table

转载 作者:行者123 更新时间:2023-11-29 02:52:20 25 4
gpt4 key购买 nike

我有一本看起来像这样的字典(设置页面):

Logout = Logout;
Social = (
Facebook,
Twitter
);
Terms = (
"Privacy Policy",
"Terms of Service"
);

然后是正确的有序数组:

`Social, Terms, Logout`

现在我有三个部分。从 cellForRowAtIndexPath 我试图这样做:

cell.textLabel.text = [[_settingsOptions objectForKey:
[_arrayKeys objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];

我收到 NSCFConstantString 错误。当我手动输入索引数字时,一切都显示正常。但从数据源方法我得到这个错误。有人能找到错误吗?

最佳答案

示例代码作为格式化的答案(它不是):

NSString *s1 = [_arrayKeys objectAtIndex:indexPath.section];
NSArray *s2 = [_settingsOptions objectForKey:s1];
NSString *text = [s2 objectAtIndex:indexPath.row];
cell.textLabel.text = text;

真正的代码将具有实际类型(我猜)和描述性名称,而不是 s1 s2,文本。
仅提供中间体类型和描述性名称可能会使错误变得清晰。

现在每个步骤都可以独立调试,如果需要,还可以使用 NSLog。

关于ios - NSCFConstantString objectAtIndex : error in grouped table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24353962/

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