afnetworking

AFNetworking Return value from async task iOS

好久不见. 提交于 2019-12-06 14:04:25
I recently have asked about nil value from AFNetwirking GET query. Here is the question I've got an answer + (void)getRequestFromUrl:(NSString *)requestUrl withCompletion:((void (^)(NSString *result))completion { NSString * completeRequestUrl = [NSString stringWithFormat:@"%@%@", BASE_URL, requestUrl]; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:completeRequestUrl parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSString *results = [NSString stringWithFormat:@"%@", responseObject]; if (completion) completion

Uploading large files on iOS with AFNetworking - error Request Timeout

有些话、适合烂在心里 提交于 2019-12-06 13:47:33
I'm facing with the next problem. In my project, I'm using AFNetworking for all network operations. One of them is uploading video the the server. Then I'm trying to upload large video (about 100 Mb), I'm getting request timeout error. Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x15641b30 {NSErrorFailingURLStringKey= http://server.name/path , NSErrorFailingURLKey= http://server.name/path , NSLocalizedDescription=The request timed out., NSUnderlyingError=0x16f7a000 "The request timed out."} Now I'm using AFNetworking v1.3.3, and I can't use v2.0 because iOS5

Can any one please tell, about the use of AFNetworking. Then it support all xcode version or not?

£可爱£侵袭症+ 提交于 2019-12-06 13:41:27
I download one example from this link . Currently I am using xcode 4.2. It shows AFNetworkReachabilityStatus as undeclared variable. Please give any link to learn AFNetworking . There are different versions of AFNetworking. Latest AFNetworking 2.0 and higher requires Xcode 5, targeting either iOS 6.0 and above, or Mac OS 10.8 Mountain Lion (64-bit with modern Cocoa runtime) and above. For compatibility with iOS 5 or Mac OS X 10.7, use the 1.x release . For compatibility with iOS 4.3 or Mac OS X 10.6, use the 0.10.x release . Now if you want to support ios 4.3 or greater use 0.10 release.

Host supports TLS 1.2, AFNetworking handshake failing

点点圈 提交于 2019-12-06 13:35:44
问题 I am trying to post to a server that supports TLS 1.2 -- at least when I perform a GET in a browser I can verify that the communication uses TLS 1.2 and that the cert is validated by a cert authority. However, when I try to POST in my code to that server using AFNetworking iOS 9.0 (13A4305g) / Xcode 7-beta4 I'm getting a handshake failure. AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.requestSerializer = [AFHTTPRequestSerializer

Cancelling batch request in AFNetworking

偶尔善良 提交于 2019-12-06 13:16:54
问题 So I have a batch request which is the following code: [[AHClient sharedClient] enqueueBatchOfHTTPRequestOperationsWithRequests:requestArray progressBlock:^(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations) { } completionBlock:^(NSArray * operations){ dispatch_async(dispatch_get_main_queue(), ^(void){ //update the UI }); }]; I tried cancelling the request by saving the path of the url in an array and do the following: for (NSString * urlPath in self

iOS AFNetworking - ASP.NET Web API .ASPXAUTH storage and deletion

孤街醉人 提交于 2019-12-06 12:13:23
问题 I'm using the AFNetworking Framework for iOS. I've subclassed AFHttpClient and are using it as a singleton, i.e. [TestAFClient sharedClient] I'm consuming an ASP.NET Web Service API that requires the use of the .ASPXAUTH cookie. First I have to authenticate, receive the .ASPXAUTH cookie in response, and then must pass this cookie with each subsequent request. After a few tests, it appears that, because I'm using a singleton AFHTTPClient, the .ASPXAuth cookie persists and, thus, no explicit

AFHTTPRequestOperation doesn't work after stand by mode

老子叫甜甜 提交于 2019-12-06 11:57:45
问题 I am developing a app which upload multiple files. For uploading, I use AFHTTPRequestOperation . It successfully works, But If I lock and after it unlock the screen,then It stop uploading files. My code for upload file is here NSUserDefaults *defaultUser = [NSUserDefaults standardUserDefaults]; NSString *userId = [defaultUser stringForKey:@"UserId"]; AFHTTPClient *client= [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",UploadURL,userId]]]; NSDictionary

How can I save a html file with external resources using AFNetworking?

懵懂的女人 提交于 2019-12-06 11:14:04
I would like to save a .html webpage with AFNetworking, but would also like to save the resources (such as .css files, .js files, images etc) within the webpage so that the whole webpage can be viewed offline. Is this possible with AFNetworking, and how would I do it? Could a short example be posted please? Thanks! AFNetworking is not necessary to do this. Instead, what you want to do is use an NSURLCache subclass that supports disk cacheing (such as Peter Steinberger's fork of SDURLCache ). With that in place, just load up a URL using a UIWebView (this may not necessarily have to be displayed

After setting custom headers in AFNetworking 2.x, the parameters are not being received by the RESTful API

倖福魔咒の 提交于 2019-12-06 11:02:15
I followed the suggested solution at AFNetworking 2.0 add headers to GET request to specify custom headers for the request with the following code snippet: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; [manager.requestSerializer setValue:someID forHTTPHeaderField:@"some_id"]; NSDictionary *parameters = @{@"id": user.id, @"birthday": user.birthday}; [manager POST:[NSString stringWithFormat:@"%@/user_create",BaseURLString] parameters:parameters success:^(AFHTTPRequestOperation *operation, id

AFNetworking and Network Errors

痴心易碎 提交于 2019-12-06 09:49:35
问题 I am using the AFNetworking framework to make several JSON web request. During development if I fail to provide a required parameters or the Service developers have broken something :-) i receive a 500 error The Error block of AFJSONRequestOperation is correctly catching it. However i cannot see the page body because AfNetworking is cancelling the request as soon as the error code in the head is received. Is there some work around. I would like to spit out the response body to the log. 回答1: