I want to store all the emails into an array. What do I need to do for the same ?
Asked
Active
Viewed 39 times
1
-
response{ 0 = { email = "grover@gmail.com"; firstname = Grover; }; 1 = { email = "hems@gmail.com"; firstname = Gems; }; 2 = { email = "rohit@gmail.com"; firstname = Rohit; }; } – Gurp321 Jul 19 '16 at 07:09
-
In the same question, I want to get the email and first name of index 2. How can I do that ? – Gurp321 Jul 19 '16 at 09:05
-
NSString * email = [[repsonseDict objectForKey:@"yourIndex"]objectForKey:@"email"]] //set "firstname" for name – Pranav Jul 19 '16 at 09:14
1 Answers
0
Use this code and change it according to your requirement
NSMutableDictionery * repsonseDict = [[NSMutableDictionery alloc]init];
repsonseDict = [reponseObj objectForKey@"response"];
NSArray * allKeys = [repsonseDict allKeys];
NSMutableArray * emailArr = [[NSMutableArray alloc]init];
for(int i = 0; i < [allKeys count]; i ++ ){
NSString * numberKey = [NSString stringWithFormat:@"%d",i];
[emailArr addObject:[[repsonseDict objectForKey:numberKey]objectForKey:@"email"]];
}

Pranav
- 701
- 4
- 18
-
I have to match the stored emails to another email. how to go further ? can you help ? – Gurp321 Jul 19 '16 at 07:32
-
@Gurp321 you are welcome..you can also up vote as an apericeation if you want :) – Pranav Jul 19 '16 at 07:33
-
-
-
In the same question, I want to get the email and first name of index 2. How can I do that ? – Gurp321 Jul 19 '16 at 09:15
-
NSString * email = [[repsonseDict objectForKey:@"yourIndex"]objectForKey:@"email"]] //set "firstname" for name – Pranav Jul 19 '16 at 09:16