[英]Profile Pic not Getting From Facebook graph api
I am not getting my facebook profile pic . 我没有得到我的Facebook个人资料照片。 I am getting my facebook id =739615472819667; 我正在获取我的Facebook ID = 739615472819667;
+(NSDictionary *)getImage:(NSString *)idd
{
NSLog(@"%@",idd);
NSDictionary *imageDictionary;
if ([self hasInternetConnection] == YES) {
NSString *urlStr=[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture",idd];
NSMutableURLRequest *request=[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
imageDictionary = [self sendRequest:request];
NSLog(@"%@",imageDictionary);
return imageDictionary;
}
}
try this 尝试这个
NSString *userImageURL = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large", pass your ID];
// pass this String where U need, like convert URL to Image or else
Other query parameters that can be used are: 可以使用的其他查询参数是:
I got the output for your ID friend, example 我得到了您的ID朋友的输出,例如
https://graph.facebook.com/739615472819667/picture?type=large
It will work (Replace FbID with your FBID). 它将起作用(用您的FBID替换FbID)。
`NSString *strProfilePicURL = nil; NSString * strProfilePicURL = nil;
if ([[NSUserDefaults standardUserDefaults]objectForKey:@"FbID"]!=nil) 如果([[NSUserDefaults standardUserDefaults] objectForKey:@“ FbID”]!= nil)
{ {
strProfilePicURL=[NSString stringWithFormat:@" https://graph.facebook.com/%@/picture ",[[NSUserDefaults standardUserDefaults]objectForKey:@"FbID"]]; strProfilePicURL = [NSString stringWithFormat:@“ https://graph.facebook.com/%@/picture”,[[NSUserDefaults standardUserDefaults] objectForKey:@“ FbID”]];
} }
imgSelf=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:strProfilePicURL]]];` imgSelf = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:strProfilePicURL]]]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.