通过iOS获取Facebook图片的问题 [英] Problem getting Facebook pictures via iOS

查看:115
本文介绍了通过iOS获取Facebook图片的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过iOS上的Facebook连接来获取事件和个人资料图片,
我已经提出了以下要求:

  [facebook requestWithGraphPath:@me / pictureandDelegate:self]; 

和响应处理方法:



<$ p $($)$($)$($)$($)$($)$($)$($)$($)$($)$ ;

NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];

imageView.image = [UIImage imageWithData:data];
}

它不会工作,结果变量类型是NSConcreteMutableData和url变量值为空。



请帮助:)
谢谢。

解决方案

NSConcreteMutableData是实际的图像数据,而不是其URL。所有你需要的是

 (void)request:(FBRequest *)request didLoad:(id)result {
imageView .image = [UIImage imageWithData:result];
}


I'm trying to fetch events and profile pictures via Facebook connect on iOS, I've made for example the request:

[facebook requestWithGraphPath:@"me/picture" andDelegate:self];

and the response handling method:

(void)request:(FBRequest *)request didLoad:(id)result {

    NSString *url = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];

    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];

    imageView.image = [UIImage imageWithData:data];
}

and it won't work, the result variable type is NSConcreteMutableData and the url variable value is null.

help please :) Thanks.

解决方案

The NSConcreteMutableData is the actual image data, not its URL. All you needed was

(void)request:(FBRequest *)request didLoad:(id)result {
    imageView.image = [UIImage imageWithData:result];
}

这篇关于通过iOS获取Facebook图片的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆