Ios 无法从Facebook graph api获取个人资料图片

Ios 无法从Facebook graph api获取个人资料图片,ios,objective-c,iphone,Ios,Objective C,Iphone,我没有得到我的facebook个人资料图片。 我正在获取我的facebook id=739615472819667 +(NSDictionary *)getImage:(NSString *)idd { NSLog(@"%@",idd); NSDictionary *imageDictionary; if ([self hasInternetConnection] == YES) { NSString *urlStr=[NSString s

我没有得到我的facebook个人资料图片。 我正在获取我的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;

    }
}
试试这个

 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
可以使用的其他查询参数包括:

  • 类型:小型、普通、大型、方形
  • 宽度:
  • 高度:
    • 同时使用“宽度”和“高度”可获得裁剪的纵横比填充图像
我得到了你的ID朋友的输出,例如

https://graph.facebook.com/739615472819667/picture?type=large

它将起作用(用您的FbID替换FbID)

`NSString*strProfilePicURL=nil

如果([[NSUserDefaults standardUserDefaults]objectForKey:@“FbID”]!=nil)

{

strProfilePicURL=[NSString stringWithFormat:@“,[[NSSERDEFAULTS standardUserDefaults]objectForKey:@“FbID”]

}

imgSelf=[UIImage imageWithData:[NSData DATAHETCONTENTSOFURL:[NSURL]
URLWithString:strProfilePicURL]]`

如果您有疑问,请在此URL中添加您的ID,并在浏览器中检查图像是否出现,根据您自己的需要使用此URL。如果您在此方法中出错,请使用imageDictionary=[self sendRequest:request],检查一下