2012-01-17 7 views
0

Serverは、下図のようにJSONオブジェクトを返します。その51個のオブジェクトJSONオブジェクトのUITableView

[{"location":"Location1","email":"[email protected]","phone":"123456"},{"location":"Location2","email":"[email protected]","phone":"123456789"}, 
. 
. 
.. 
.. 
..51] 

の周りに、私は、電子メールと電話番号と場所とdetailviewに、この値を最初テーブルビューを割り当てたい...

コード使用私は以下の通りです:私は間違って提案してくださいよ

- (void)connectionDidFinishLoading:(NSURLConnection *)connection { 
    [connection release]; 

    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; 
    [responseData release]; 

    NSDictionary *dictionary = [responseString JSONValue]; 
    NSArray *response = [dictionary objectForKey:@"location"]; 

    exercises = [[NSArray alloc] initWithArray:response]; 
    [table reloadData]; 
} 

...

答えて

2

から一見、応答文字列は、データが

NSArray* arrayOfDictionaries = [responseString JSONValue]; 
NSDictionary* firstDictionary = [arrayOfDictionaries objectAtIndex:0]; 
ような何かをしようとアクセスするための辞書

の配列のように見えます