如何将key = 0的值存储到nsarray中?

时间:2016-07-19 07:08:30

标签: ios nsarray nsmutabledictionary

我想将所有电子邮件存储到一个数组中。我需要做些什么呢?

1 个答案:

答案 0 :(得分:0)

使用此代码并根据您的要求进行更改

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