根据我收集的内容,我想强制一个类使用特定的私有字段(和方法)我需要一个抽象类,因为接口只声明public/static/final字段和方法.正确??
我刚开始我的第一个大型java项目,并希望确保我以后不会伤害自己:)
使用Facebook iOS SDK,假设我对用户的个人资料图片执行图形请求:
[FBRequest requestForGraphPath:@"me/picture"]
Run Code Online (Sandbox Code Playgroud)
我会收到这个错误:
Response is a non-text MIME type; endpoints that return images and other binary data should be fetched using `NSURLRequest` and `NSURLConnection`.
Run Code Online (Sandbox Code Playgroud)
这背后的原因是什么?手动编写请求只需要一分钟,但为什么这个常见任务不包含在Facebook iOS SDK中,或者我错过了什么?
通过Github上的Facebook iOS SDK repo,我们可以看到FBRequestConnection.m:
if (!error && [response.MIMEType hasPrefix:@"image"]) {
error = [self errorWithCode:FBErrorNonTextMimeTypeReturned
statusCode:0
parsedJSONResponse:nil
innerError:nil
message:@"Response is a non-text MIME type; endpoints that return images and other "
@"binary data should be fetched using NSURLRequest and NSURLConnection"];
}
Run Code Online (Sandbox Code Playgroud)
如果我正确理解这一点,FBRequestConnection得到我想要的反应(即个人资料图片)然后告诉我我不能拥有它.多么可爱啊.为什么要首先提出请求?
对此有何评论?