Using AFNetworking 3.0.1,
I'm trying to set an imageView with a URL, using UIImageView+AFNetworking.h.
The URL links to a jpeg image.
I get a failure message : Request failed: unacceptable content-type: image/jpg
I see there was a solution in AFNetworking 2, using the additional imageResponseSerializer property. But it's been removed from AFNetworking 3. Are we supposed to use something else ?
Waiting for any info, I'll try to download the images manually.
Hi @neywen!
With 3.0, you have access to the sharedImageDownloader on the image view, which has access to the AFHTTPSessionManager, where you can freely update the responseSerializers to include whatever content response type you need.
:beers:
That was the fastest response, ever. Thank you very much for your help, I'll get a look right now.
cheers,
n.
So, if that's any help to anyone :
#import <AFNetworking/UIImageView+AFNetworking.h>
#import <AFNetworking/AFImageDownloader.h>
AFImageResponseSerializer* serializer = (AFImageResponseSerializer*)[UIImageView sharedImageDownloader].sessionManager.responseSerializer;
serializer.acceptableContentTypes = [serializer.acceptableContentTypes setByAddingObject:@"image/jpg"];
:+1:
Hi @neywen!
With 3.0, you have access to the
sharedImageDownloaderon the image view, which has access to theAFHTTPSessionManager, where you can freely update theresponseSerializersto include whatever content response type you need.馃嵒
it saved me ^_^
Most helpful comment
So, if that's any help to anyone :