![](/img/trans.png)
[英]Getting Facebook profile picture URL from graph API for Ionic Hybrid Application
[英]Profile Pic not Getting From Facebook graph api
我沒有得到我的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:@“ https://graph.facebook.com/%@/picture”,[[NSUserDefaults standardUserDefaults] objectForKey:@“ FbID”]];
}
imgSelf = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:strProfilePicURL]]]];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.