afnetworking

AFNetworking setImageWithURLRequest download progress

拥有回忆 提交于 2019-12-10 23:23:51
问题 I am using this code to set image to UIImageView. NSURLRequest *URLRequest = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:imageToLoad]]; [imageView setImageWithURLRequest:URLRequest placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { [cell.image setImage:image]; [cell.activityIndicator stopAnimating]; } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) { // Nothing }]; But I want to track download progress

UIImageView Cache policies - AFNewtorking

随声附和 提交于 2019-12-10 22:59:14
问题 I have several UIImageView's in my app that I use AFNetworking's setImageWithURL to populate an image from my server. The documentation says that this method uses the standard UIImageView cache policy. My issue is that if I update an image on my server, the image does not get updated in the app soon enough. Even if I close out of the app and restart. If I want images to update I have to reinstall the app, which clears the cache and brings in new images. Obviously this is not a desired effect

AFNetworking and caching

橙三吉。 提交于 2019-12-10 21:23:37
问题 I am downloading WMS tiles which I want to cache. I'm using AFNetworking which includes NSURLCache. The responses from the server do not contain Cache-Control protocols in the header. I asked the server guy about this and was unfamiliar with server side cache-control. At the moment, he is swamped with other work. Do I need him to implement the cache-control or can I force NSURLCache to cache them w/out the info the response header? Is NSURLCache persistent? If so, how can I clear the cache?

NSURLConnection (as part of AFNetworking) doesn't call NSURLConnectionDataDelegate delegate

浪尽此生 提交于 2019-12-10 19:06:33
问题 The Issue I am using AFNetworking, which generates an NSURLConnection object, to upload a photo. The NSURLConnection is not making any calls to the - (void)connection:(NSURLConnection __unused *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite method. (It's part of the NSURLConnectionDataDelegate protocol, defined in NSURLConnection.h) The request is an HTTP POST request with a

AFNetworking Library failing in iOS 7

泪湿孤枕 提交于 2019-12-10 18:54:07
问题 Using the new iOS 7 Beta and downloading the latest version of AFNetworking, I went to File>Add Files to Project, and passed in the directory AFNetworking.framework. Now I'm getting a slew of linker errors. For a sanity check, I rolled back the commit history to iOS 6 and everything compiled successfully. Here's the log: Undefined symbols for architecture i386: "_OBJC_CLASS_$_AFHTTPClient", referenced from: _OBJC_CLASS_$_CloudGlyphAPIClient in CloudGlyphAPIClient.o "_OBJC_CLASS_$

NSURLSession for network images download+cache

孤街醉人 提交于 2019-12-10 18:33:51
问题 There are many third parties libraries for loading a network image and then store it into a disk and/or memory. However it is very easy to implement it using simple NSURLSession API call. here is the code: NSURLCache *myCache = [[NSURLCache alloc] initWithMemoryCapacity: 16384 diskCapacity: 268435456 diskPath: cachePath]; // these numbers are only for the usage example. defaultConfigObject.URLCache = myCache; defaultConfigObject.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;

AFNetworking deadlock on tasks (tasksForKeyPath)

 ̄綄美尐妖づ 提交于 2019-12-10 18:13:12
问题 I'm sure this is something stupid that i'm doing, but after an hour I cannot see it. Maybe you can. Edit : this is on a device (iPhone 5S w/iOS 8.4), not the simulator. I have an iOS 8 app with a DownloadManager, a singleton that subclasses AFHTTPSessionManager using a BackgroundSession. It used to work fine, but now I've done something and the result is that AFNetworking deadlocks in setDownloadTaskDidFinishDownloadingBlock , when I reference self.tasks.count : [self

POST request with JSON body AFNetworking 2.0

限于喜欢 提交于 2019-12-10 17:28:41
问题 Is there anyway to send a POST request with a JSON body using AFNetworking ~> 2.0? I have tried using: manager.requestSerializer = [AFJSONRequestSerializer serializer]; manager POST:<url> parameters: @{@"data":@"value"} success: <block> failure: <block>' but it doesn't work. Any help is greatly appreciated. Thanks 回答1: You can add your JSON body in NSMutableURLRequest not direct in parameters: . See my sample code : NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; //

AFNetworking XML Request Issue

雨燕双飞 提交于 2019-12-10 16:27:27
问题 I'm using AFNetworking-2 with JSON response and it was working fine and now I have to convert it to XML instead of using JSON because the server response is in XML. After I've searched I reached with this code but it is not working. With Charles I found the request is wrong "Fail to parse data (org.xml.sax.SAXParseException: Content not allowed is prolog)" Please where would be my issue? My code: NSString *urlString = BaseURLString; NSURL *url = [[NSURL alloc] initWithString:urlString];

cocoapods安装和使用,教程,经验

試著忘記壹切 提交于 2019-12-10 16:11:27
目录 CocoaPods是什么? 如何下载和安装CocoaPods? 如何使用CocoaPods? 场景1:利用CocoaPods,在项目中导入AFNetworking类库 场景2:如何正确编译运行一个包含CocoPods类库的项目 场景3:使用中可能会出现的问题及相应解决方法 CocoaPods是什么? 当你开发iOS应用时,会经常使用到很多第三方开源类库,比如JSONKit,AFNetWorking等等。可能某个类库又用到其他类库,所以要使用它,必须得另外下载其他类库,而其他类库又用到其他类库,“子子孙孙无穷尽也”,这也许是比较特殊的情况。总之小编的意思就是,手动一个个去下载所需类库十分麻烦。另外一种常见情况是,你项目中用到的类库有更新,你必须得重新下载新版本,重新加入到项目中,十分麻烦。如果能有什么工具能解决这些恼人的问题,那将“善莫大焉”。所以,你需要 CocoaPods。 CocoaPods应该是iOS最常用最有名的类库管理工具了,上述两个烦人的问题,通过cocoaPods,只需要一行命令就可以完全解决,当然前提是你必须正确设置它。重要的是,绝大部分有名的开源类库,都支持CocoaPods。所以,作为iOS程序员的我们,掌握CocoaPods的使用是必不可少的基本技能了。 如何下载和安装CocoaPods? 在安装CocoaPods之前,首先要在本地安装好Ruby环境