-1

Working with Json, how can I "NSlog" only the title in this code:

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"]];

Something like NSlog(@"%@", title); ?

Thanks!

Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
Frenck
  • 6,514
  • 5
  • 22
  • 25

1 Answers1

1

If I have understood what you are asking correctly, then this should do it:

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

If that gives you a compiler warning because the object may not be an NSString, then you can do:

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

If I've misunderstood your question, please let me know and I will correct my answer accordingly.

Will Pragnell
  • 3,073
  • 1
  • 20
  • 21