Using the Facebook iOS SDK, let's say I perform a graph request for the user's profile picture:
[FBRequest requestForGraphPath:@"me/picture"]
I'll receive this error:
Response is a non-text MIME type; endpoints that return images and other binary data should be fetched using `NSURLRequest` and `NSURLConnection`.
What is the reasoning behind this? It only took a minute to write the request manually but why isn't this common task included in the Facebook iOS SDK or am I missing something?
Looking through the Facebook iOS SDK repo on Github, we see this in 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"];
}
If I'm understanding this correctly, FBRequestConnection
gets the response I want (i.e. the profile image) and THEN tells me I can't have it. What a tease. Why make the request in the first place?
Any comments on this?
For large picture
me?fields=picture.type(large)
Refer to Facebook Graph API Change: Picture type (size) no longer working?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With