我正在使用 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”之类的图形路径,但它们都会导致相同的错误。