웹 서비스에서 json을 구문 분석하는 첫 번째 iOS 앱을 빌드하려고합니다. 내 .H 파일에서iOS에서 json 문자열 구문 분석 목표 C
은 내가 웹 사이트를 호출하고 배열에 데이터를 저장 내하는 .m 파일에서 배열
NSArray *items;
을 만들 수 있습니다. 이 모든 것은 결국 나는 uitableview에 데이터를 표시하려고 노력하고있다.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"ItemsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSLog(@"%@",items);
NSDictionary *item = [items objectAtIndex:indexPath.row];
NSString *title = [item objectForKey:@"title"];
cell.title.text = title;
return cell;
}
항목의 nslog는 생산 :
{
category = code;
keyword = "";
limit = 20;
lowPrice = "";
page = 0;
products = (
{
description = "...";
mobileFriendly = 1;
popularity = 2021;
productId = code;
title = "title";
}, and so on...
)
내가 NSDictionary에 일을하려고 오류를 얻고있다 * 항목 = [항목 objectAtIndex : indexPath.row] 그것은 objectAtIndex : indexPath.row를 수행하는 것이 올바르지 않다고 말합니다.
내가 뭘 잘못하고 있니?
도움 주셔서 감사합니다.
감사합니다. – Stephen