如何从iphone中的fb中获取相册图像
NSURL *url1=[NSURL URLWithString:@"https://graph.facebook.com/100002944043966/albums?access_token=[your access token]"];
NSData *data = [NSData dataWithContentsOfURL:url1];
NSLog(@"%@",data);
NSString *str=[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"%@",str);
通过使用这个我能够获得json数据,但是如何从此获得图像,请帮助我!提前致谢!如何从iphone中的fb中获取相册图像
要获得封面照片使用本:
https://graph.facebook.com/<id>/picture?type=album&access_token=<token>
这里ID是在您收到和访问令牌是您的会话令牌JSON cover_photo。
如何从URL1获取图像数据,我的问题是这样而已! – 2012-07-09 06:15:43
从url1的响应中解析json,你说你得到了json,从那里你会发现专辑的详细信息,为所需的相册带上cover_photo,然后使用这个url来获取图像数据。 – DivineDesert 2012-07-09 06:23:07
我已经正确地访问了cover_photo,但是当我通过url获取数据时:https://graph.facebook.com/
您未能为传入的imagedata(NSData alloc)
分配内存。
您可以使用此代码...
NSString *imageurl;
NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:imageurl]];
UIImageView *imageview;
imageview.image=[UIImage imageWithData:imageData];
如何从url1获取图片数据,我的问题是这样的! – 2012-07-09 06:15:27
邮报JSON来看看它是如何的样子.. – 2012-07-09 04:30:15