2016-07-19 62 views
1

我想將所有電子郵件存儲到一個數組中。我需要爲同樣的事情做些什麼?如何將key = 0中的值存儲到nsarray中?

+0

響應{ 0 = { 電子郵件= 「gro[email protected]」; firstname = Grover; }; 1 = {0} {email =「[email protected]」; firstname =寶石; }; 2 = {0} {0} {email =「[email protected]」; firstname = Rohit; }; } – Gurp321

+0

檢查我的回答 –

+0

在同一個問題中,我想獲取電子郵件和索引2的名字。我該怎麼做? – Gurp321

回答

0

使用此代碼,並根據您的要求進行更改

NSMutableDictionery * repsonseDict = [[NSMutableDictionery alloc]init]; 
    repsonseDict = [reponseObj [email protected]"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"]]; 
    } 
+0

感謝它爲我工作。 – Gurp321

+0

我必須將存儲的電子郵件與另一封電子郵件進行匹配。如何走得更遠?你能幫我嗎 ? – Gurp321

+0

@ Gurp321歡迎您...如果您願意,您也可以投票作爲apericeation :) –

相關問題