{
データ = (
{
"created_time" = "2011-09-28T07:29:37+0000";
から = {
ID = 100002944043966;
name = "alok sinha";
};
高さ = 500;
icon = "https://s-static.ak.facebook.com/rsrc.php/v2/yz/r/StEh3RhPvjk.gif";
ID = 114750595299741;
画像 = (
{
高さ = 2048;
source = "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s2048x2048/300035_114750595299741_1543248164_n.jpg";
幅 = 2048;
}、
{
高さ = 500;
source = "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/300035_114750595299741_1543248164_n.jpg";
幅 = 500;
}、
{
高さ = 500;
source = "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/300035_114750595299741_1543248164_n.jpg";
幅 = 500;
}、
{
高さ = 480;
source = "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s480x480/300035_114750595299741_1543248164_n.jpg";
幅 = 480;
}、
{
高さ = 320;
source = "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s320x320/300035_114750595299741_1543248164_n.jpg";
幅 = 320;
}、
{
高さ = 180;
source = "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/300035_114750595299741_1543248164_a.jpg";
幅 = 180;
}、
{
高さ = 130;
source = "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/300035_114750595299741_1543248164_s.jpg";
幅 = 130;
}、
{
高さ = 130;
source = "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/s75x225/300035_114750595299741_1543248164_s.jpg";
幅 = 130;
}
);
link = "https://www.facebook.com/photo.php?fbid=114750595299741&set=a.114750591966408.20279.100002944043966&type=1";
画像 = "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/300035_114750595299741_1543248164_s.jpg";
位置 = 1;
source = "https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/300035_114750595299741_1543248164_n.jpg";
"updated_time" = "2011-09-28T07:29:38+0000";
幅 = 500;
}
);
ページング = {
next = "https://graph.facebook.com/114750591966408/photos?value=1&redirect=1&limit=25&after=MTE0NzUwNTk1Mjk5NzQx";
};
}
4 に答える
2
NSArray *jsonArray; // your parsed array
NSDictionary *dict = [jsonArray objectAtIndex:0]; // there might be more of the objects and you might need to put that into a forin cycle, but for simplicity this is an example for an array with only one dictionary in it
NSArray *images = [dict objectForKey:@"images"];
NSMutableArray *links = [NSMutableArray array];
for (NSDictionary *img in images) {
[links addObject:[img valueForKey:@"source"]];
}
これで、リンクは必要なNSStringオブジェクトの配列になります。必要に応じて、それらをNSURLに変換することもできます。
于 2012-07-09T09:50:54.720 に答える
2
さて、あなたの画像の配列は[jsonObject objectForKey:@"images"]、それらすべてをループして取得[loopObject objectForKey:@"source"]し、最後に、忘れないでください[jsonObject objectForKey:@"source"]
于 2012-07-09T09:51:22.113 に答える
1
[yourDictionary objectForKey:@"data"]辞書を与える。
NSDictionary *dictionary = [yourDictionary objectForKey:@"data"]
NSArray *images = [dictionary objectForKey:@"images"];
NSMutableArray *sourceUrls = [[NSMutableArray alloc] initWithCapacity:0];
for (NSDictionary *subDictionary in images]) {
[sourceUrls addObject:[subDictioanary objectForKey:@"source"]];
}
お役に立てればと思います。
于 2012-07-09T09:52:22.733 に答える
-1
コードにSBJSONパーサーを含めます。次に、SBJson.hを実装ファイルにインポートします。次に、以下のコードを使用します。
NSMutableDictionary *responseDictionary = [yourJsonString JSONValue];
NSArray *imageArray = [responseDictionary objectForKey:@"images"];
NSMutableArray *sourceImage=[[NSMutableArray alloc]init]
for(int i=0;i<[imageArray count];i++){
{
[sourceImage appendString:[[imageArray objectAtIndex:i]objectForKey:@"source"]];
}
于 2012-07-09T09:51:04.730 に答える