个人资料图片不从Facebook获取图表api

问题描述:

我没有收到我的Facebook个人资料图片。 我得到我的Facebook的ID = 739615472819667;个人资料图片不从Facebook获取图表api

+(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 

enter image description here

+0

不工作........ – varun

+0

如果u有疑问添加你的ID在这个网址,并检查浏览器,如果图像是否来 –

+0

雅图像即将到来,但在我的代码它的返回null – varun

它会工作(用您的FBID替换FbID)。

`NSString * strProfilePicURL = nil;

如果([[NSUserDefaults的standardUserDefaults] objectForKey:@ “FBID”] =零!)

{

strProfilePicURL = [NSString的stringWithFormat:@ “https://graph.facebook.com/%@/picture”,[[NSUserDefaults的standardUserDefaults] objectForKey:@ “FBID”]];

}

imgSelf = [UIImage的imageWithData:[NSData的dataWithContentsOfURL:[NSURL URLWithString:strProfilePicURL]]];`