Ios AFN正在缓存图像,而不在Swift的ImageView中显示它
我知道AFNetworking有一个功能,可以在图像加载到ImageView时缓存图像Ios AFN正在缓存图像,而不在Swift的ImageView中显示它,ios,objective-c,swift,afnetworking,Ios,Objective C,Swift,Afnetworking,我知道AFNetworking有一个功能,可以在图像加载到ImageView时缓存图像 但是,我想缓存图像而不在ImageView中显示它,我找不到任何相关函数。使用[NSBundle mainBundle]resourcePath]获取缓存路径,然后使用NSFileManager编写文件/对象/文档等。类似这样的东西(目标C不是Swift-但你明白了) 实现savePNGImage以在本地保存图像 AFHTTPRequestOperation *requestOperation = [[AFH
但是,我想缓存图像而不在ImageView中显示它,我找不到任何相关函数。使用[NSBundle mainBundle]resourcePath]获取缓存路径,然后使用NSFileManager编写文件/对象/文档等。类似这样的东西(目标C不是Swift-但你明白了) 实现savePNGImage以在本地保存图像
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
[self savePNGImage:responseObject withFilename:imageUrl];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@", [error description]);
}];
[requestOperation start];