afnetworking

The network connection was lost - Error Domain=kCFErrorDomainCFNetwork Code=-1005 - in GET response

房东的猫 提交于 2020-01-15 10:11:31
问题 I get this error just in GET request. At the server side, we have Apache HTTP Server that manages requests and responses to Tomcat. There are two clients Android and iOS. Everything in Android app works fine. On the other side, in iOS app all of the POST responses are OK, the problem is just with GET responses. I tracked the requests, all of them are received on the server side app and regarding the logs, the server sends the response to the client but the client didn't get any response. None

How to sent data in variable via POST and AFNetworking?

强颜欢笑 提交于 2020-01-15 03:26:15
问题 I use this method: NSDictionary *params = @{@"email" : email, @"password" : pass }; NSString* HOST_URL = @"http://server.com:8080"; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:HOST_URL]]; NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"/login" parameters:params]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; [httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]

Waiting for request to be processed [duplicate]

对着背影说爱祢 提交于 2020-01-14 05:58:07
问题 This question already has answers here : Can AFNetworking return data synchronously (inside a block)? (6 answers) Closed 6 years ago . I was wondering if I could wait for request to be processed with afnetworking. Lets say I got this method - (MWPhoto *)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index { //Request goes here, so the method doesn't return anything before it's processed } Is that doable? 回答1: This would be referred to a synchronous request. If the method

CoreData not compatible with an AFNetworking request from a GCD queue?

本小妞迷上赌 提交于 2020-01-14 05:16:29
问题 I am using GCD to start a long-running background process ('run_loop') that creates an NSManagedObjectContext ('MOC'), monitors CoreData objects, and sometimes (when they're ready) uploads a serialization of them to a webserver and then deletes them. I am using AFNetworking for the HTTP calls. The problem is in the request completion handler blocks, as the blocks run in a different thread to the owner of the MOC, which isn't supported by CoreData. I have tried storing the NSThread from the

AFNetworking 3 AFMultipartFormData getting bytes data in response

◇◆丶佛笑我妖孽 提交于 2020-01-14 04:43:08
问题 I'm doing this to send images in an array to server: NSString *string = [NSString stringWithFormat:@"%@/API/Upload",BaseURLString]; AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc]initWithBaseURL:[NSURL URLWithString:BaseURLString]]; [manager setRequestSerializer:[AFHTTPRequestSerializer serializer]]; [manager setResponseSerializer:[AFHTTPResponseSerializer serializer]]; for(NSData *eachImage in self.fetchedAtt) { [manager POST:string parameters:nil constructingBodyWithBlock:^(id

How to create .cer file for AFNetworking to be used in iOS app bundle

半世苍凉 提交于 2020-01-14 03:04:12
问题 I keep seeing disjointed accounts all over the web of what the .cer file is and how to generate it so that the app can properly communicate with the server via https. To quote this source, one person says: 1) You now need .cer files in your bundle for all certificates in the chain. So, at least, two certificate files must be present (your certificate and the root CA). In our case, we needed an intermediate as well. 2) These certificates must be in a particular order. Specifically, the

Large Image Caching from Afnetworking

回眸只為那壹抹淺笑 提交于 2020-01-13 13:10:39
问题 I'm using AFNetworking to download some images from the internet to my app. I'm using this code to download those images, AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_linkString[indexPath.item]]]]; requestOperation.responseSerializer = [AFImageResponseSerializer serializer]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { _imageView = [

Error Domain=com.alamofire.error.serialization.response Code=-1011 “Request failed: internal server error (500)”

断了今生、忘了曾经 提交于 2020-01-13 09:39:10
问题 I am using afnetworking in my application. To post data on server I wrote following code - (void) callLoginAPI:(NSDictionary *)dictProfile{ // 1 NSDictionary *params = @{@"username":[dictProfile valueForKey:@"name"], @"first_name":[dictProfile valueForKey:@"first_name"], @"last_name":[dictProfile valueForKey:@"last_name"], @"email":[dictProfile valueForKey:@"email"], @"dob":[dictProfile valueForKey:@"birthday"], @"gender":[dictProfile valueForKey:@"gender"], @"location":[[dictProfile

Pre-cache Images for AFNetworking's UIImageView category

僤鯓⒐⒋嵵緔 提交于 2020-01-13 08:43:09
问题 When my app loads, I pull down a JSON representation of 99 objects. Each object has an 'image_url' field, which I pass to AFNetworking's setImageWithURLRequest . My images load in a tableView, and consequently, only the first several cells make requests for their images. It's not until I scroll down that subsequent image requests are made. Once I pull down the initial dataset, I'd like to be able to kick off a background process that goes out and downloads the 95 or so objects that aren't

Using AFIncrementalStore with an Auth token

无人久伴 提交于 2020-01-12 10:11:13
问题 I'm working on an iOS client for App.net, and I'd like to use AFIncrementalStore to sync the web service with my Core Data implementation in the app. I've gotten the two to work for API requests that don't require an auth token, but I can't figure out how to use the auth token with AFIncrementalStore. In other words, I'm able to pull down the global feed, since it doesn't require auth: https://alpha-api.app.net/stream/0/posts/stream/global ...however, to get a user's stream, you need auth