Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios [\uu NSCFNumber length]:发送到实例UITableView的无法识别的选择器_Ios_Objective C_Json_Uitableview_Nsmutablearray - Fatal编程技术网

Ios [\uu NSCFNumber length]:发送到实例UITableView的无法识别的选择器

Ios [\uu NSCFNumber length]:发送到实例UITableView的无法识别的选择器,ios,objective-c,json,uitableview,nsmutablearray,Ios,Objective C,Json,Uitableview,Nsmutablearray,我遇到了一个错误 [\uu NSCFNumber length]:发送到实例0x15580c90的无法识别的选择器 2014-02-18 15:10:49.490 CIB[1706:60b]*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFNumber length]:未识别的选择器发送到实例0x15580c90' *第一次抛出调用堆栈: (0x2da18e83 0x37d756c7 0x2da1c7b7 0x2DA10B0AF

我遇到了一个错误

[\uu NSCFNumber length]:发送到实例0x15580c90的无法识别的选择器 2014-02-18 15:10:49.490 CIB[1706:60b]*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFNumber length]:未识别的选择器发送到实例0x15580c90' *第一次抛出调用堆栈: (0x2da18e83 0x37d756c7 0x2da1c7b7 0x2DA10B0AF 0x2d969dc8 0x2e33b695 0x2e33b169 0x301ab2fd 0x1603ad 0x302cf315 0x302776cd 0x30276ef1 0x3019d353 0x2FE239443 0x2FE167 0x2FE19 0x2FE19 0x2FE19 0x2FE10D 0x2FE18F 0x2fe1854d 0x2FE18F 0x2fe1854d 0x2DE9E3F69 0x2D9E18F 0x2D9471 0x2d94c253 0x3268EB30201845 0x1131 0x2FE1867) libc++abi.dylib:以NSException类型的未捕获异常终止

我这里有一个回路。从Json中的数组到我的模型任务列表,然后存储到NSMutableArray\u任务列表

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;}
其中一个(不确定是哪个,但我猜是
taskCount
)是一个NSNumber。文本接受一个字符串

cell.titleLabel.text = txn.funcCdDscp;
cell.totalCountLabel.text = [txn.taskCount stringValue];

使用此选项,因为这是
最佳解决方案

cell.totalCountLabel.text = [NSString stringWithFormat:@"%@",txn.taskCount];

在这里,它需要的是
NSString
而不是
NSNumber
,这就是它崩溃的原因。因此,将其转换为
NSString
,然后它就会得到解决。

如果您正在从webservice操作JSON数据,希望以下内容将对您有所帮助

cell.textLabel.text=[NSString stringWithFormat:@"%@",[[JsonDictionaryObject objectForKey:@"Respected_Key_Name"]objectAtIndex:indexPath.row]];

检查表numberofrowsection是否在表numberofrowsection和cellForRowAtIndexPath方法上放置断点,在该方法中发生了错误?stringValue帮助+1完美。查找正在加载UILabel.text的所有DB对象。其中一个可能是NSN号码。
cell.textLabel.text=[NSString stringWithFormat:@"%@",[[JsonDictionaryObject objectForKey:@"Respected_Key_Name"]objectAtIndex:indexPath.row]];