hivesolutions / cameo

A generic framework for iOS interaction
http://cameo.hive.pt
Apache License 2.0
0 stars 0 forks source link

Need support for requesting an image and/or raw data #2

Closed tsilva closed 9 years ago

tsilva commented 9 years ago

The only types of request I have available are HMJsonRequest and HMProxyRequest, and neither of these work for retrieving an image.

tsilva commented 9 years ago

AFNetworking supports using an AFImageResponseSerializer as the response serializer. This makes is so that the response is already returned as an UIImage. This is not very worthwhile because creating and image from NSData is very simple (eg: UIImageJPEGRepresentation(topImage, 1.0)). So probably what makes sense here is being able to retrieve raw data and let the developer parse the response himself.

joamag commented 9 years ago

HMProxyRequest should work with any type of data, but yes a proper specialized class should be created to retrieva an UIImage directly

joamag commented 9 years ago

Simple dummy usage, note that the proxy is allocated inline (a global static one should be used instead)

self.proxy = [[HMProxy alloc] init];
[self.imageView setImageWithURLString:@"http://httpbin.org/image/png" proxy:self.proxy];