我正在使用Facebook Graph API v2.0。以下通话
[FBRequestConnection startWithGraphPath:@"/me/picture" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(@"%@", result);
} else {
NSLog(@"%@", [error userInfo]);
}
}];
导致此错误:
{
NSLocalizedDescription = "Response is a non-text MIME type; endpoints that return images and other binary data should be fetched using NSURLRequest and NSURLConnection";
"com.facebook.sdk:ErrorSessionKey" = "<FBSession: 0x10f036250, state: FBSessionStateOpen, loginHandler: 0x100073a40, appID: 863523550341327, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x10f0339c0>, expirationDate: 4001-01-01 00:00:00 +0000, refreshDate: 2014-07-27 17:20:14 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(\n installed,\n \"public_profile\",\n email,\n \"user_birthday\",\n \"user_location\",\n \"user_friends\"\n)>";
"com.facebook.sdk:HTTPStatusCode" = 0;
}
有人知道为什么会这样吗?我真正需要的只是一个包含我个人资料图片网址的响应。在2012年或更早的时候,提出了类似的问题,但是自那时以来,API发生了变化。除非您确实确定将我重定向到的问题具有有效的解决方案,否则请勿将其标记为重复项。我尝试了其他几种选择,例如自己启动连接并使用诸如“ / me?fields = picture”之类的图形路径,但是它们都导致相同的错误。
看来我的原始通话要求提供图片。为了获得基于文本的回复,该回复提供了个人资料照片的网址,以下内容对我有用:
[FBRequestConnection startWithGraphPath:@"me?fields=picture.height(500),picture.width(500)"completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error) {
}
}];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句