サーバーから受信した JSON データを解析する次のコードがあります。
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
NSArray *array_webdata=[[NSArray array] init];
NSString *searchStatus = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding];
array_webdata = [parsedata objectWithString:searchStatus error:nil];
NSDictionary *usersList = [array_webdata valueForKey:@"results"];
// NSArray *keys = [usersList allKeys];と書くと、これは本当の NSDictionary ではないと思います。実行がクラッシュする
NSLog(@"\n usersList =\n %@ \n", usersList);
[searchStatus release];
[connection release];
[webData release];
[pool drain];}
usersList に格納されている json データの構造は次のとおりです。
(
{
createTime = "date hour";
fullname = "user name";
"prof_id" = number;
thumb = "image.jpg";
},
{
data of rest of users...
}
)
そして、各ユーザーのデータを格納するクラスを作成し、特定の用途で使用したい場合は「prof_id」を使用したいと考えています。アプリにはすべてのユーザー(テーブルビューではない)のリストが必要なため、これが必要です。これが最も簡単な方法だと思います。
誰かが私を助けることができますか?ありがとう!!