afnetworking-2

AFNetworking AFHTTPClient Class

試著忘記壹切 提交于 2020-01-13 10:07:07
问题 I’m fairly new to iOS programming, especially when it comes to webservices. I’m developing a App for academic purposes, and I need to communicate with my server, currently using AFNetworking2 and Restler/php, everything work when it comes to GET methods. But I can’t upload anything. Been reading for hours, in github support site, stackoverflow, pretty much all examples/questions to upload images (and there are a LOT) use this line: AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:[NSURL

AFNetworking 2.0: NSURLSessionDownloadTask is cancelled when received 302 to AWS S3

旧巷老猫 提交于 2020-01-13 05:23:47
问题 I'm using a simple example from the README file (from AFNetworking 2.0 page) to download an image. All works fine for the images served directly from my web-sever. But for those located on the S3 the web-server returns 302 Redirect the following error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" When I try to download the image (using the same code) directly from the S3 (omitting the redirection) I receive the same error. I've checked the availability of the actual image with wget.

AFHTTPRequestOperation Cancel Request

泪湿孤枕 提交于 2020-01-11 09:18:34
问题 Is there a way to cancel a AFHTTPRequestOperation? I am using it to download a PLIST for example. So I was planning to have a button to cancel the download or task. Is there a way? Update: operationQueue = [NSOperationQueue new]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:myURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; operation

AFNetworking 2.0 POST issue, Cocoa error 3840(JSON text did not start with array…)

泄露秘密 提交于 2020-01-11 08:32:10
问题 I am attempting to call api.php on my local server(using MAMP). The server side api.php is being called but the content of _POST inside the php code contains the following error: Error Domain = NSCocoaErrorDomain Code = 3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo = 0x15d7bdd0 {NSDebugDescription = JSON text did not start with array or object and option to allow fragments not set.

AFNetworking 2.0 download multiple images with completion

本小妞迷上赌 提交于 2020-01-10 15:38:06
问题 I'm trying to figure out a way to download multiple images with AFNewtorking 2.0. I've read a lot of posts here in SO, but can't find the answer I'm looking for, hope you guys can help me. The problem is that I want to know when all of the downloads finished and if all images where downloaded. So I have an array with image URL's ant trying to do something like this. for(NSString *photoUrlString in self.photos){ NSURL *url = [NSURL URLWithString:photoUrlString]; AFHTTPRequestOperation

Having trouble with NSString return type in Objective-C blocks [duplicate]

纵饮孤独 提交于 2020-01-07 04:33:06
问题 This question already has answers here : How do I return a variable from a block inside a method? (3 answers) Returning a variable value outside a block - Objective-C, iOS (1 answer) returning UIImage from block (3 answers) Closed 5 years ago . Thanks guy for help you. My problem is next. I need use AFNetworking and when request petition to server, the server is response. This result I need return in my method. The method AFNetworking use block for succes or failed. I want return the return

How to download the large amount of data using AFNetworking Library to show the better performance in ios?

拥有回忆 提交于 2020-01-06 15:14:31
问题 I am using AFNetworking Library, How to download the large amount of data using AFNetworking Library to show the better performance? I have followed the following steps: " .zip " files downloading the content from server. I have added one url , like this i have so many url's to download the content from the server. It takes too much time. How to perform the fast downloading from server. My Query is: If the url was not found on server, then it executes failure state. but the ".zip" is storing

How to download the large amount of data using AFNetworking Library to show the better performance in ios?

浪子不回头ぞ 提交于 2020-01-06 15:12:02
问题 I am using AFNetworking Library, How to download the large amount of data using AFNetworking Library to show the better performance? I have followed the following steps: " .zip " files downloading the content from server. I have added one url , like this i have so many url's to download the content from the server. It takes too much time. How to perform the fast downloading from server. My Query is: If the url was not found on server, then it executes failure state. but the ".zip" is storing

AFNetworking 2.0 always return 403

不羁岁月 提交于 2020-01-06 07:26:11
问题 I'm making a GET request for JSON using AFNetworking 2.0 self.managerMasterFetchDeletes = [AFHTTPRequestOperationManager manager]; self.managerMasterFetchDeletes.requestSerializer.timeoutInterval = 4.0f; self.managerMasterFetchDeletes.requestSerializer = [AFJSONRequestSerializer serializer]; self.managerMasterFetchDeletes.responseSerializer = [AFJSONResponseSerializer serializer]; NSURL *URL = [NSURL URLWithString:rest]; NSURLRequest *request = [NSURLRequest requestWithURL:URL];

AFNetworking code giving me Memory Leaks

丶灬走出姿态 提交于 2020-01-05 17:51:11
问题 @implementation GetData static NSString *string = @"https://afternoon-springs-7986.herokuapp.com/"; static NSString *baseStr = @"https://afternoon-springs-7986.herokuapp.com/updateInformation"; -(void) postEventInfo: (NSDictionary *) eventInfoObject { NSURL *url = [NSURL URLWithString:string]; // 6.5% // NSURL *baseURL = [NSURL URLWithString:@"http://localhost:5000/"]; UIWindow *window = [[UIApplication sharedApplication] keyWindow]; UIView *topView = window.rootViewController.view; self