afnetworking

HttpClient setReachabilityStatusChangedBlock declares no interface

隐身守侯 提交于 2019-12-23 16:09:26
问题 Trying to use AFNetworkings ReachabilityStatusChanged but getting "No visible @interface for HTTPCLIENT declares the selector setReachabilityStatusChangeBlock" But HttpClient has that function. Anyone know why this is happening? AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://stat-api.herokuapp.com/"]]; [client setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status){ NSLog(@"%d", status); }]; /// UPDATE /////////// Here is my .pch file

iOS - How to pass array to AFNetworking as parameters (Objective-C)

懵懂的女人 提交于 2019-12-23 15:44:52
问题 I have a php file which I want to use to process data. The php file contains a function that takes in an array as parameters. php function: func((array)$input->foos as &$foo){ $request = mb_strtolower($foo->request); $found = false; $loopCount = 0; while($found === false && $loopCount < 3){ if($request === 'single' || $request === 'corner'){ $foo->request = $single_priority[$loopCount]; } else if($request === 'double'){ $foo->request = $double_priority[$loopCount]; } else if($request ===

AFURLConnectionOperation.m Implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'NSInteger' (aka 'int')

老子叫甜甜 提交于 2019-12-23 15:40:02
问题 I got a warning in Xcode 5.1 as stated below AFNetworking 2.2.0: AFURLConnectionOperation.m Implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'NSInteger' (aka 'int') Is this important? 回答1: This mean is arm64 architecture int64_t range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 but int range is -2,147,483,648 to 2,147,483,647 . so compiler say to Loss of value. See a this: ConvertingYourAppto-64Bit if you don't want more warning. you can must change

How to Upload Images Using AFNetworking directly from iPad app

拥有回忆 提交于 2019-12-23 12:13:45
问题 I am totally new to iOS.I want to upload images to my server using AFNetworking . I tried it but it still not done. Please Help me, thanks in advance 回答1: try with this its work for me -(void) uplodeImages{ AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:@"url where to upload images"]]; NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:@"cat1.png"]); NSDictionary *parameters = @{@"username": @"", @"password" :

AFNetworking - How to specify multiple values for one key

可紊 提交于 2019-12-23 11:49:24
问题 I am trying to pass multiple values for one parameter key to an HTTP request using the AFHTTPClient method "postPath". However, the parameters variable is an NSDictionary so I can not set multiple values for my key "email". I've tried sending the e-mail values as a comma separated string but that does not work as my server returns an error saying I have not specified any e-mail value. I did read in the documentation about using multipartFormRequestWithMethod method but I could not completely

AFNetworing - setImageWithURLRequest not working

那年仲夏 提交于 2019-12-23 10:24:43
问题 I want to set tableview cell images in one of my apps. I use AFNetworking (1.2.1) and I do it with setImageWithURLRequest . My code in which I set images looks like this: if (user.avatar) { NSString *imageUrl = user.avatar.url; [cell.profileImage setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imageUrl]] placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { [cell setNeedsLayout]; } failure:^(NSURLRequest *request,

AFNetworking iOS11 - HTTP load failed -999

折月煮酒 提交于 2019-12-23 09:49:59
问题 I have an app in production that has been running fine for a while. However, since iOS 11 - I am receiving this error: Task <51E07EF5-6F31-4E58-8818-7712CB3E49A6>.<20> HTTP load failed (error code: -999 [1:89]) Task <51E07EF5-6F31-4E58-8818-7712CB3E49A6>.<20> finished with error - code: -999 This happens on iOS 11 only. Also, it is not consistent. Out of five requests to the same URL, two will fail with this. On a Cellular connection, it happens less often, but its still there. I am using

Get NSData straight from AFNetworking, rather than letting it convert to UIImage

隐身守侯 提交于 2019-12-23 08:07:14
问题 Is there a flag that would let me get NSData, rather than let AFNetworking convert my responseData into the corresponding data type(UIImage, NSString)? 回答1: The AFHTTPResponseSerializer will return the raw NSData : AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; [manager GET:... parameters:... success:^(AFHTTPRequestOperation *operation, NSData *responseObject) {} failure:...]; 回答2:

Send a bunch of requests one-by-one [closed]

偶尔善良 提交于 2019-12-23 06:00:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I need to send 100 network requests to my server one-by-one and get notified when the 100th is done. I'm using AFNetworking and was thinking about a solution of this problem. Can anyone recommend me something? 回答1: A couple of thoughts: If really just going to run each request serially (i.e. one after another),

Simple “PUT” file upload with AFNetworking

北城余情 提交于 2019-12-23 04:54:28
问题 I suppose it is pretty simple but I couldn't figure out how to do it. I want to upload a file to using a PUT request to a webservice using AFNetworking library. This is the curl command I used to test the service mac:~ user$ curl --verbose -T image.jpeg http://server.org:8001/social/test.jpg * About to connect() to server.org port 8001 (#0) * Trying 123.45.123.123... * connected * Connected to server.org (123.45.123.123) port 8001 (#0) > PUT /social/test.jpg HTTP/1.1 > User-Agent: curl/7.24.0