afnetworking-2

Swift Custom Response Serializer is returning images at random

安稳与你 提交于 2019-12-08 13:20:37
I am currently using Alamofire to Fetch Json data/url-images from a Server. I also created a custom response serializer using this tutorial to convert url images into UIImages upon request. Everything works fine, and I am able to load all of the Images from the server into a UIImageView. The user can then swipe from left to right in order to View each image like a Photo Gallery. The Problem I am having is that my custom response returns the images in a different order. Therefore, every image being displayed is not in the correct order it initially started in. Would anyone know how I can fix

Using AFNetworking to Download File in iOS

核能气质少年 提交于 2019-12-08 12:20:54
问题 I want to be able to download a file using AFNetworking that supports: ProgressBar, Pausing, and Resuming download. Approaching this on my own I was able to come up with this code, except that it doesn't support pausing or resuming: -(void)downloadFile:(NSString *)UrlAddress indexPathofTable:(NSIndexPath *)indexPath { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:UrlAddress]]; NSString *pdfName = [self pdfNameFromURL:UrlAddress]; AFHTTPRequestOperation *operation =

AFNetworking 2.0 - How to pass response to another class on success

只愿长相守 提交于 2019-12-08 11:37:53
问题 I am wondering how can I call AFHTTPSessionManagern from different class. Currently I use this code to get the response but I am not sure how to convert this to singleton class which requires parameters and postback link. I am receiving and processing JSON code only. static NSString * const BaseURLString = @"http://www.example.com/"; NSURL *baseURL = [NSURL URLWithString:BaseURLString]; NSDictionary *parameters = @{ @"Token" : @"123456"}; AFHTTPSessionManager *manager = [[AFHTTPSessionManager

AFNetworking with Java and Glassfish

ε祈祈猫儿з 提交于 2019-12-08 08:56:34
问题 This could be a longshot question, but I haven't found any specific tutorials or articles on this particular combination of technologies. My intentions are to use my own APIs (from Java Beans deployed on a GlassFish server) on the iOS device using AFNetworking. The problem is, I don't really understand the linkage method between the server and the iOS device. How does the iOS code gain access to GlassFish webservices (for example)? Disclaimer: I have no experience in this particular field (i

How to use AFHTTPSessionManager for a GET request?

眉间皱痕 提交于 2019-12-08 07:57:53
问题 So I want to use AFNetworking V2.0 for a GET request with NSURLSession (iOS7's new API) So far I have got this - but is this the correct way to do it? NSString *tempURL =[NSString stringWithString:url]; AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; [manager GET:tempURL parameters:params success:^(NSURLSessionDataTask *task, id responseObject) { //Working }failure:^(NSURLSessionDataTask *task, NSError *error) { //Failed!! }]; Would this be the correct way to do it? 回答1: I

Getting Request failed: unacceptable (406) when posting parameters

心不动则不痛 提交于 2019-12-08 03:59:19
问题 i am posting the parameter in the web-service. using the below code. and i am getting the "Request failed: unacceptable (406) Error .I am not sure is im posting it right . I tried posting the data using their key and value pair using POSTMAN chrome app . and it is working fine there.Not here pls suggest .i am using Afnetworking for the first time [params setValue:self.txtUserName forKey:@"name"]; [params setValue:self.txtEmail forKey:@"mail"]; [params setValue:self.txtPass forKey:@"conf_mail"

Queue of AFHTTPRequestOperations creating Memory Buildup

别等时光非礼了梦想. 提交于 2019-12-08 02:44:24
问题 I just updated to AFNetworking 2.0 and I am re-writing my code to download data & insert it into Core Data. I download JSON data files (anywhere from 10-200mb files), write them to disk, then pass them off to background threads to process the data. Below is the code that downloads the JSON & write it to disk. If I just let this run (without even processing the data), the app uses up memory until it is killed. I assume as the data is coming in, it is being stored in memory, but once I save to

How to migrate AFHTTPClient, Afnetworking 1.0 to 2.0

北城以北 提交于 2019-12-08 00:57:47
问题 My problem is that I have a old code and I dont know how to change it. I had 1 class called API (AFHTTPClient) I have problems with 2 methods because I dont know how to put them in 2.0: This: -(void)commandWithParams:(NSMutableDictionary*)params onCompletion:(JSONResponseBlock)completionBlock { NSMutableURLRequest *apiRequest = [self multipartFormRequestWithMethod:@"POST" path:kAPIPath parameters:params constructingBodyWithBlock: ^(id formData) { //TODO: attach file if needed }];

Can AFNetworking 2 store the cookies

不羁岁月 提交于 2019-12-07 15:44:56
问题 I used AFHTTPClient and seems it stored cookies in the box. So when I was logged in. and then reload my app, the cookies were in application automatically. Maybe I confused about this. But seems it works in the way I described. Now I use this code: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager POST:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { } failure:^(AFHTTPRequestOperation *operation, NSError *error)

Does AFNetworking cache images load automatically or do we have to do it manually?

你说的曾经没有我的故事 提交于 2019-12-07 10:46:45
问题 I'm using AFNetworking to load images from JSON feed. In here, first time when user opens the app, images load from the internet. It's fine. But when user go back and come again from another view, while using the app, images should load from the cache, not from the internet. How can I do that? - (void)loadDetailData { detailPost = nil; NSString *detailUrl = [NSString stringWithFormat:@"%@", self.Details.firsturl]; AFHTTPRequestOperationManager *detailManager = [AFHTTPRequestOperationManager