haiiiのようなjsonデータがあります
{
NetworkMembers = (
{
id = 1;
memberId = 1;
networkId = 1;
position = 0;
type = H;
},
そして最後に、次のように配列に入れました:
for (int i=0; i<[array count]; i++) {
NSDictionary *dictionary = [array objectAtIndex:i];
NSArray *array2=[dictionary valueForKey:@"NetworkMembers"];
for (int j=0; j<[array2 count]; j++) {
NSDictionary *dictionary2 = [array2 objectAtIndex:j];
NSLog(@"J value %@",[dictionary2 valueForKey:@"type"]);
[self.tablArray addObject:[dictionary2valueForKey:@"type"]];
[self.tablArray addObject:[dictionary2 valueForKey:@"id"]];
}
}
最後に、私は tableArray ( H, 1, H, 2, H, 3, H, 4, H, 6 のようになり、インデックスパスの行のセルに次のようなコードを書きました
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"testing"];
if(!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"testing"];
}
cell.textLabel.text = [tablArray objectAtIndex:indexPath.row];
if([tablArray count]>0)
{
cell.detailTextLabel.text=[[tablArray objectAtIndex:indexPath.row]stringValue];
}
return cell;
しかし、詳細テキストラベルを印刷すると、キャッチされていない例外 'NSInvalidArgumentException' が原因でアプリを終了するなどのエラーが発生します。理由: '-[__NSCFString stringValue]: 認識されないセレクターがインスタンス 0x109314510 に送信されまし た'