afhttpsessionmanager

AFHTTPSessionManager subclass swift

痞子三分冷 提交于 2019-12-11 12:26:05
问题 What is the correct way to create singletone subclass of AFHTTPSessionManager with custom session configuration? class DefaultSessionConfiguration: NSURLSessionConfiguration { override init () { super.init() self.HTTPShouldSetCookies = true HTTPCookieStorage?.cookieAcceptPolicy = NSHTTPCookieAcceptPolicy.Always HTTPAdditionalHeaders = [ "Content-Type": "application/json"]; } } let baseUrl = "https://google.com" class HTTPManager: AFHTTPSessionManager { static let _sharedAPIManager =

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 =

AFNetworking 3.x what is the different between AFHTTPSessionManager and AFURLSessionManager?

半腔热情 提交于 2019-12-05 23:23:30
问题 I'm about to upgrade AFNetworking from 1.x to 3.x. My question is what is the different between AFHTTPSessionManager and AFURLSessionManager ? and when to use each? Which one support both XML and JSON request and response? Thanks 回答1: You generally use AFHTTPSessionManager if you want to do GET or POST requests that might include preparation of JSON or x-www-formurlencoded requests or parsing of complex responses. You can get away with AFURLSessionManager if you're doing very simple requests

AFHTTPSessionManager posting video swift

半腔热情 提交于 2019-12-04 19:18:51
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 = NSBundle.mainBundle().bundleIdentifier let config = NSURLSessionConfiguration

AFHTTPSessionManager to use SOAP based service

孤街醉人 提交于 2019-12-02 06:35:33
问题 I checked few posts (this and this) in Stackoverflow but none of them answered "How to use AFHTTPSessionManager to use SOAP based web service". Is it not possible or we need to do some tweaking like subclassing etc? I can call the SOAP based using AFHTTPRequestOperation but this is what I don't want to use since I have XML & JSON web services there I am using AFHTTPSessionManager . I want to have similar approach throughout my application. My codes using RequestOperation is : NSString

AFHTTPSessionManager to use SOAP based service

核能气质少年 提交于 2019-12-02 03:13:56
I checked few posts ( this and this ) in Stackoverflow but none of them answered "How to use AFHTTPSessionManager to use SOAP based web service". Is it not possible or we need to do some tweaking like subclassing etc? I can call the SOAP based using AFHTTPRequestOperation but this is what I don't want to use since I have XML & JSON web services there I am using AFHTTPSessionManager . I want to have similar approach throughout my application. My codes using RequestOperation is : NSString *soapMessage = @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:Envelope xmlns:xsi=\"http://www.w3.org

File uploading progress issue

喜夏-厌秋 提交于 2019-11-27 08:50:35
问题 I am uploading a single file in a table view cell using AFNetworking. Uploading is working alright. But when I scroll my cell off view, the progress is gone or some times it displays different progress values like 20% or 50%, and again 30%. This is my code: //Tableview Cell configure var cell : ChattingPhotoCell! if message.vendorType == .Receiver { //Receive Image message cell = tableView.dequeueReusableCell(withIdentifier: "ReceiveChattingPhotoCell") as! ChattingPhotoCell if cell == nil {