我正在以以下格式下载 iOS 中的图像:
"Content-Encoding" = gzip;
"Content-Type" = "text/html";
Date = "Thu, 31 Oct 2013 19:08:58 GMT";
Expires = "Thu, 01 Jan 1970 00:00:00 GMT";
"Set-Cookie" = "JSESSIONID=1mrh644zbpgutn1xk116n825u;Path=/";
"Transfer-Encoding" = Identity;
我正在尝试使用这个:https ://github.com/st3fan/cocoa-utils/blob/master/src/NSDataGZipAdditions.m来进行取消归档......但它似乎没有工作。
这是我当前无法正常工作的代码:
NSString *authHeader = [NSString stringWithFormat:@"OAuth %@", credentials.accessToken];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:myURL];
[request addValue:authHeader forHTTPHeaderField:@"Authorization"];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue new] completionHandler:^(NSURLResponse *response, NSData *data, NSError *err) {
NSLog(@"Response: %@", response);
if (err) {
NSLog(@"Error: %@", err);
}
//here create file from _data_
NSData *mydata = [NSData dataWithCompressedData:data];
self.propImg1.image = [UIImage imageWithData:mydata];
[self.propImg1 setNeedsLayout];
有谁知道如何做到这一点?
谢谢