당신은 페이스 북의 그래프에서 이미지를 얻을이 같이있는 UIImageView에 넣을 수 있습니다 : 프로젝트 don' 경우
-(void) getUserImageWithProfileId:(NSString *)profileId{
int imgWidth = 125;
int imgHeight = 125;
NSString *urlPath = [NSString stringWithFormat:@"%@/picture?width=%d&height=%d",profileId,imgWidth,imgHeight];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://graph.facebook.com/"]];
[client getPath:urlPath parameters:nil success:^(AFHTTPRequestOperation *operation, id data) {
UIImage *imageFromURL = [UIImage imageWithData:data];
//HERE DO ANITHING WITH THE UIIMAGE, you can put it on a UIImageView or something
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//fail
}];
}
하면,이 코드는 ARC 함께, HTTP 요청을 할 다운로드 AFNetworking Framework 필요 그것을 사용하여 client
을 autoreleased하고 AFNetworking 라이브러리에 플래그를 넣으십시오 (링크에서 설명하는 방법을 참조하십시오)