2012-02-12 3 views
-1
JSON 작업

, 어떻게 내가이 코드에서 제목 만 "NSlog"NSlog(@"%@", title); 같은NSDictionary 객체에서 문자열을 NSLog하는 방법은 무엇입니까?

NSDictionary *item = [tableData objectAtIndex:[indexPath row]]; 
    // Set text on textLabel 
    [[cell textLabel] setText:[item objectForKey:@"title"]]; 
    // Set text on detailTextLabel 
    [[cell detailTextLabel] setText:[item objectForKey:@"description"]]; 

뭔가?

감사합니다. 내가 제대로 요구하는 것을 이해 한 경우

답변

1

,이 그것을 수행해야합니다

NSLog(@"%@", [item objectForKey:@"title"]); 

을하는 당신에게 컴파일러 경고를 제공하는 경우있는 NSString하지 않을 수 있습니다 개체가, 당신이 할 수 있기 때문에 :

NSString *title = [item objectForKey:@"title"]; 
NSLog(@"%@", title); 

질문에 대한 오해를 한 경우 알려 주시면 답변을 정정 해 드리겠습니다.