gpt4 book ai didi

ios - [__NSCFNumber 长度] : unrecognized selector sent to instance UITableView

转载 作者:IT老高 更新时间:2023-10-28 12:49:14 31 4
gpt4 key购买 nike

我遇到了一个错误

[__NSCFNumber length]: unrecognized selector sent to instance 0x15580c90 2014-02-18 15:10:49.490 CIB[1706:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x15580c90' * First throw call stack: (0x2da18e83 0x37d756c7 0x2da1c7b7 0x2da1b0af 0x2d969dc8 0x2e33b695 0x2e33b169 0x301ab2fd 0x1603ad 0x302cf315 0x302776cd 0x30276ef1 0x3019d353 0x2fe23943 0x2fe1f167 0x2fe1eff9 0x2fe1ea0d 0x2fe1e81f 0x2fe1854d 0x2d9e3f69 0x2d9e18f7 0x2d9e1c43 0x2d94c471 0x2d94c253 0x326862eb 0x30201845 0x113de1 0x3826eab7) libc++abi.dylib: terminating with uncaught exception of type NSException

我这里有循环。从 Json 中的数组到我的模型任务列表,然后存储到 NSMutableArray _tasklist

NSArray *taskJson = [json objectForKey:@"fOTaskListModelWss"];

for (NSDictionary *dictCQ in taskJson) {
NSLog(@"TASKLIST: %@", [dictCQ objectForKey:@"foTaskListModelWs"]);

NSDictionary *datadic = [dictCQ objectForKey:@"foTaskListModelWs"];
TaskList *task = [[TaskList alloc]init];
[task setTaskCount:datadic[@"count"]];
[task setFuncCd:datadic[@"funcCd"]];
[task setFuncCdDscp:datadic[@"funcCdDscp"]];
[task setRequestStatus:datadic[@"requestStatus"]];
[task setRole:datadic[@"role"]];
[_taskList addObject:task];
}

那么这是我在 cellForRowAtRowPathIndex 中的代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString * simpleTableIdentifier = @"MenuTableViewCell";
MenuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MenuTableViewCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
TaskList *txn = [_taskList objectAtIndex:indexPath.row];
cell.titleLabel.text = txn.funcCdDscp;
cell.totalCountLabel.text = txn.taskCount;
return cell;}

最佳答案

cell.titleLabel.text = txn.funcCdDscp;
cell.totalCountLabel.text = txn.taskCount;

其中一个(不确定是哪个,但我猜是 taskCount)是一个 NSNumber。文本采用 NSString。

关于ios - [__NSCFNumber 长度] : unrecognized selector sent to instance UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21846792/

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