afnetworking-2

AFNetworking 2.0 cancel specific task

别等时光非礼了梦想. 提交于 2019-12-20 09:37:18
问题 I am trying out afnetworking 2.0 and just trying to figure out how to cancel specific tasks. The old way would be to use something like [self cancelAllHTTPOperationsWithMethod:@"POST" path:@"user/receipts"] but I dont see anything like this in 2.0 I created a sub class of AFHTTPSessionManager which gives me access to the array of pending tasks and I can cancel them directly but I dont know how to identify 1 task from another so I can cancel only specific tasks. Task does have an

How To POST JSON Parameters Using AFNetworking?

送分小仙女□ 提交于 2019-12-19 19:54:42
问题 how can I POST JSON parameters with AFNetworking ? Below is the example JSON format. Thank you in advance. { "application": { "identifier": "appDev" }, "sso": { "version": 2.0, "session_expiry": 43200 }, "user": { "password": "xxxx~!@", "username": "xxx0min" }, "coordinate": { "latitude": 10.9948629, "longitude": -169.5213749 } } I successfully created a JSON : NSDictionary *parameters = @{@"application": @{@"identifier": @"appDev"}, @"sso": @{@"version": @"2.0", @"session_expiry":@43200}, @

How To POST JSON Parameters Using AFNetworking?

邮差的信 提交于 2019-12-19 19:54:12
问题 how can I POST JSON parameters with AFNetworking ? Below is the example JSON format. Thank you in advance. { "application": { "identifier": "appDev" }, "sso": { "version": 2.0, "session_expiry": 43200 }, "user": { "password": "xxxx~!@", "username": "xxx0min" }, "coordinate": { "latitude": 10.9948629, "longitude": -169.5213749 } } I successfully created a JSON : NSDictionary *parameters = @{@"application": @{@"identifier": @"appDev"}, @"sso": @{@"version": @"2.0", @"session_expiry":@43200}, @

“pod update” doesn't update to latest version

我只是一个虾纸丫 提交于 2019-12-19 05:11:28
问题 Here is my podfile I use in the project: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '9.0' use_frameworks! pod 'AFNetworking', '~> 2.0' pod 'GoogleMaps' pod 'MONActivityIndicatorView' pod 'NYXImagesKit' pod 'MagicalRecord' pod 'FBSDKCoreKit' pod 'FBSDKShareKit' pod 'FBSDKLoginKit' pod 'Countly' The problem is that cocoapods 0.39 is updating AFNetworking to version 2.5.4 which is wrong. The latest version is 2.6.3 Also facebook SDK updating to 4.4 (latest is 4.8) etc. I

How to show ProgressBar With AFNetworking AFHTTPRequestOperationManager

丶灬走出姿态 提交于 2019-12-19 04:25:16
问题 I am trying to show the Progress Bar as I download a JSON from a url. The JSON is downloading correctly but I am not sure how to show the Progress Bar. I have tried using UIProgressView but it does not display on the screen. Any suggestions would be appreciated. CGFloat width = [UIScreen mainScreen].bounds.size.width; CGFloat height = [UIScreen mainScreen].bounds.size.height; CGRect rect = CGRectMake(width/2, height/2, width/5, height/5); UIProgressView *myProgressView = [[UIProgressView

AFNetworking 2.0: NSLocalizedDescription=Request failed: unacceptable content-type: text/html

五迷三道 提交于 2019-12-19 03:46:18
问题 I tried to GET html from Apple homepage. AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:@"http://www.apple.com/jp" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"HTML: %@", responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Error: %@", error); }]; This failed with error message as below: 2014-02-07 14:54:22.922 Tests[1833:70b] Error: Error Domain

How to work with large file uploads in ios?

独自空忆成欢 提交于 2019-12-18 16:38:14
问题 My app requires upload of video files from users phone which will then be processed on server. THe problem is the size of the file can go to 200 MB plus and the user won't keep the application open to wait for the file to upload. Since apple doesn't allow apps to run in background for more than a limited time. How can I ensure that my files are uploaded. I am using afnetworking to set up an upload task as given by ios 7 library. Please if anyone can point me in the right direction or have any

AFNetworking-2 waitUntilFinished not working

拥有回忆 提交于 2019-12-18 11:57:42
问题 I know there is another similar question, but it's for an older version of AFNetworking, and doesn't really answer it anyway. I have the following code: AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager]; manager.securityPolicy.allowInvalidCertificates = YES; manager.requestSerializer = [AFJSONRequestSerializer serializer]; [manager.requestSerializer setAuthorizationHeaderFieldWithUsername: currentUser() password: currentPassword()]; __block NSDictionary*

How can I log each request/response using Alamofire?

谁说我不能喝 提交于 2019-12-18 10:38:09
问题 Is there a way to log each request / response using Alamofire (something similar to AFNetworkActivityLogger) ? I am aware of Printable, DebugPrintable and Output (cURL) but they are not quite what I am looking for. 回答1: Something like this might be what you were looking for: extension Request { public func debugLog() -> Self { #if DEBUG debugPrint(self) #endif return self } } Usage: Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"]) .debugLog() .response {…} If you

AFNetworking posts JSON arrays as multiple single-entry dictionaries

不羁岁月 提交于 2019-12-18 06:51:05
问题 I'm having a similar issue to the one discussed here. I'm attempting to post JSON to a server. Here's the Objective-C code that should work, but doesn't. I get an empty array in the response object, not sure why: AFHTTPRequestOperation * operation = [manager POST:uploadScriptUrl parameters:mutableJSON success:^(AFHTTPRequestOperation * operation, id responseObject) { successBlock(operation, responseObject); } failure:^(AFHTTPRequestOperation * operation, NSError * error) { failureBlock