I want to display every object alone, for this dictionary (email,city,name) only: {"contact_search":{"0":{"email":"xxx","city":"xxx","name":"xxx"}}}
Asked
Active
Viewed 51 times
-3
-
1`NSString *email = [NSString stringWithString:[yourDict objectForKey:@"email"]];` ?? please clarify your question – janusfidel Jul 25 '12 at 10:54
-
1What have you tried and what's the difference between that and what you want? – Phillip Mills Jul 25 '12 at 10:55
-
how u created your dictionary? – Guru Jul 25 '12 at 10:56
1 Answers
1
It's hard to tell what you actually want.
NSDictionary *contactSearch = [dictionary objectForKey:@"contact_search"];
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, NSDictionary *contact, BOOL *stop) {
NSString *name = [contact objectForKey:@"name"];
NSString *city = [contact objectForKey:@"city"];
NSString *email = [contact objectForKey:@"email"];
NSLog(@"name: %@, city: %@, email: %@", name, city, email);
}];
This will grab the dictionary of objects and then cycle through each key/value pair printing the values

Paul.s
- 38,494
- 5
- 70
- 88
-
iam not able to reach the values of email,city,name. So what I want is to grab the values of these objects. – user1540999 Jul 25 '12 at 11:10