afnetworking-2

AFHTTPSessionManager - get unserialized/raw response body (NSData?)

Deadly 提交于 2019-12-07 09:14:44
问题 I've subclassed AFHTTPSessionManager according to the recommended best practice for iOS 8 (in place of AFHTTPOperationManager, which I was using before). I can grab the NSHTTPURLResponse from the task (except that has no body, only headers), and the callback returns the serialized responseObject which is fine. Sometimes I need to log the response as a string or display it in a text field - there doesn't appear to be a way to do this natively using SessionManager? OperationManager allowed you

Post request Amazon S3 with AFNetworking

和自甴很熟 提交于 2019-12-07 06:22:47
问题 I'm posting an image to Amazon S3 via AFNetworking, and getting a strange error. The file is uploading, but once it hits 100% it returns an error: Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: method not allowed (405)" AFAmazonS3Manager *s3manager = [[AFAmazonS3Manager alloc] initWithAccessKeyID:AWS_Access_Key secret:AWS_Secret_Key]; s3manager.requestSerializer.region = AFAmazonS3USWest1Region; s3manager.requestSerializer.bucket = AWS_Bucket_Name; //setting for

Can AFNetworking handle a queue of requests?

筅森魡賤 提交于 2019-12-07 05:45:15
问题 My example on iOS 6: 10 Multi-Part requests need to be sent (in order) to the server. (so the request forms a queue) progress should be shown. if one request fails all following should fail a request queue should be cancellable Can AFNetworking help me with this? Or should I try to build something with NSOperations and run the loops myself? If I need to pass context data between theses requests for example a transaction id produced by the first request. Are there any considerations about

AFNetworking error 53 during attempted background fetch

◇◆丶佛笑我妖孽 提交于 2019-12-07 02:59:24
问题 While updating my application to support Background App Refresh I ran into problem with AFNetworking. I am getting NSPOSIXErrorDomain Code=53 "Software caused connection abort" . The problem seems to occur in iOS 12, where the background connection gets terminated. AFNetworking 2.6.3 is used to make the fetch. AppDelegate.m : - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [OrdersService performFetch];

Getting Request failed: unacceptable (406) when posting parameters

穿精又带淫゛_ 提交于 2019-12-06 15:38:38
i am posting the parameter in the web-service. using the below code. and i am getting the "Request failed: unacceptable (406) Error .I am not sure is im posting it right . I tried posting the data using their key and value pair using POSTMAN chrome app . and it is working fine there.Not here pls suggest .i am using Afnetworking for the first time [params setValue:self.txtUserName forKey:@"name"]; [params setValue:self.txtEmail forKey:@"mail"]; [params setValue:self.txtPass forKey:@"conf_mail"]; [params setValue:self.txtPass2 forKey:@"pass"]; AFHTTPRequestOperationManager *manager =

AFHTTPSessionManager posting video swift

痞子三分冷 提交于 2019-12-06 12:31:20
问题 I am trying to upload a video in background using AFNetworking > AFHTTPSessionManager Post method. I want it to conitune uploading even if the app is suspended. But I get error while executing this code, it logs no error, and points to nowhere in code. I tried every solution available on other posts regarding my scenario, but couldn't get it working. Plesae check my code below and suggest me solution or link me somewhere to make it work { let urlString = BaseUrl + WebLinks.post let appId =

Uploading selected image from photo library using AFNetworking and PHP

*爱你&永不变心* 提交于 2019-12-06 11:29:44
I am trying to upload an image which selected from photo library using AFNetworking but I am little confused. Some code samples are using image data directly for upload and some are using file path. I want to use AFNetworking sample code here: NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"]; NSURLRequest *request = [NSURLRequest requestWithURL:URL]; NSURL *filePath = [NSURL

Queue of AFHTTPRequestOperations creating Memory Buildup

[亡魂溺海] 提交于 2019-12-06 10:56:42
I just updated to AFNetworking 2.0 and I am re-writing my code to download data & insert it into Core Data. I download JSON data files (anywhere from 10-200mb files), write them to disk, then pass them off to background threads to process the data. Below is the code that downloads the JSON & write it to disk. If I just let this run (without even processing the data), the app uses up memory until it is killed. I assume as the data is coming in, it is being stored in memory, but once I save to disk why would it stay in memory? Shouldn't the autorelease pool take care of this? I also set the

NSURLSessionDownloadTask resumes automatically all task while in background

荒凉一梦 提交于 2019-12-06 10:40:41
I have requirement to download files in serial order. Currently I am able to do that while app is in foreground. Following is the logic I have used. Create all tasks for downloading. Resume one at a time and as the current finishes resume the next one from URLSession:task:didCompleteWithError: . This logic is working while app is in foreground but once app started to run in background(By crashing) and we again run the app before download finishes all the tasks state has been changed to resume and all are downloading at the same time. Is this the expected behaviour or anything I am missing to

Swift - Why init(coder) is required in AFHTTPSessionManager?

天大地大妈咪最大 提交于 2019-12-06 08:58:40
I'm not very experienced in iOS development. While making subclass of AFHTTPSessionManager XCode suggested me to include required init(coder) : import UIKit let _sharedAPIManager = APIManager(baseURL: NSURL(string: API_URL)!) class APIManager: AFHTTPSessionManager { /** * Singleton service * (https://github.com/hpique/SwiftSingleton) */ class var sharedInstance : APIManager { return _sharedAPIManager } init(baseURL url: NSURL!) { super.init(baseURL: url, sessionConfiguration: nil) self.responseSerializer = AFJSONResponseSerializer() as AFJSONResponseSerializer self.requestSerializer =