【问题标题】:AFNetworking - add "image\jpeg" content type to AFImageResponseSerializerAFNetworking - 将“image\jpeg”内容类型添加到 AFImageResponseSerializer
【发布时间】:2014-09-30 00:46:25
【问题描述】:
【问题讨论】:
标签:
ios
facebook
afnetworking
【解决方案1】:
imageView.imageResponseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"image/jpeg", @"image/jpg"];
【解决方案2】:
我最终使用了:
-(void) loadPictureFromUrl:(NSString*)urlString {
NSURL* url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if ( !error )
[_httpRequestDelegate httpResponseReceived:nil responsedData:[[UIImage alloc] initWithData:data]];
else
[_httpRequestDelegate httpRequestReturnedError:nil withError:error];
}];
}
而不是与 AfNetworking 对抗 - 这通常很棒,但我正在尝试做的事情有问题