alamofire

Why upload alamofire background request don't executes in background?

孤者浪人 提交于 2019-12-19 11:18:30
问题 I use alamofire in order to upload 30 mb zip file to server here is my request let configuration = URLSessionConfiguration.background(withIdentifier: "identifire.com") alamoFireManager = Alamofire.SessionManager(configuration: configuration) let tempZipFilePath = UtilDirectory.tempZipPath.tweak() alamoFireManager.upload(URL(fileURLWithPath: tempZipFilePath), to: deligate.url, method: .post, headers: headers) .uploadProgress(closure: { progress in print("Upload Progress: \(progress

Extra argument 'method' in call of Alamofire

独自空忆成欢 提交于 2019-12-19 10:07:35
问题 I've searched for this issue and there are many answers available but none are solving. I've defined parameters as: let parameters = [ "name": username, "mobile": "", "email": email, "password": "", "blood_donor": "0", "registration_id": defaults.string(forKey: "FCMToken"), "platform": platform, "appID": "3" ] And after that when I send the request: Alamofire.request(url, method: .post, parameters: parameters, encoding: URLEncoding(), headers: headers).responseJSON { response in So I get a

Alamofire POST request with Swift 2

流过昼夜 提交于 2019-12-19 07:11:38
问题 I am trying to make a POST request in Alamofire to return a JSON object. This code worked in Swift 1, but in swift 2 I get this invalid parameter issue: Tuple types '(NSURLRequest?, NSHTTPURLResponse?, Result<AnyObject>)' (aka '(Optional<NSURLRequest>, Optional<NSHTTPURLResponse>, Result<AnyObject>)') and '(_, _, _, _)' have a different number of elements (3 vs. 4) It seems like the error parameter was removed, but I am using the error parameter inside the function to check for errors, so how

Alamofire POST request with Swift 2

南楼画角 提交于 2019-12-19 07:11:00
问题 I am trying to make a POST request in Alamofire to return a JSON object. This code worked in Swift 1, but in swift 2 I get this invalid parameter issue: Tuple types '(NSURLRequest?, NSHTTPURLResponse?, Result<AnyObject>)' (aka '(Optional<NSURLRequest>, Optional<NSHTTPURLResponse>, Result<AnyObject>)') and '(_, _, _, _)' have a different number of elements (3 vs. 4) It seems like the error parameter was removed, but I am using the error parameter inside the function to check for errors, so how

POST multiple json objects in Alamofire POST method - Swift/IOS

风流意气都作罢 提交于 2019-12-19 06:20:49
问题 Sorry if my question is not clear, I'll try to make myself clear with an explanation. So here is exactly what I'm trying to do, I'm trying to use Alamofire to post more than one comment (Something that my app implements and will be stored as a JSON object whenever user writes a new comment). I'm passing these JSON comments to my post routine, where I can use SwiftyJSON to extract each value. Noe the thing is I know how to set the parameters if I'm trying to authorize the user as follows, var

Alamofire 4 and special characters in JSON

為{幸葍}努か 提交于 2019-12-19 05:32:16
问题 I've got a problem with special characters with Alamofire 4. The JSON contains æ, ø and å and the browser shows them fine, also my previous solution using SwiftyJSON did. Alamofire 4 shows something like this instead: U00e6 Using this call: Alamofire.request(specificURL, method: .get, parameters: param, encoding: URLEncoding.default, headers: nil).responseJSON { (response: DataResponse<Any>) in print(response) } What to do to solve this? 回答1: Edit: Alamofire.request(url, method: .get,

Postman Body Raw Request To Swift Alamofire

爷,独闯天下 提交于 2019-12-19 04:25:14
问题 I'm trying to re-create this Postman settings for posting in Alamofire. This is my first time to see an API that requires both Parameters and a body with Raw Json. I'm done with gathering and formatting my data (either in Json using SwiftyJSON or Dictionary [String : Any] / Parameters ) for the said requirement. While I did see a similar question to this: Postman request to Alamofire request but it doesn't have a valid answer. Assume that I'm quite experienced with posting/getting/etc data

Creating a generic method with AlamoFire in Swift

╄→尐↘猪︶ㄣ 提交于 2019-12-19 04:05:44
问题 I am using AlamoFire for my API calls, and have something like this all over my project: static func login(userName: String, password: String) -> User { let parameters = ["userName": userName , "password": password] let user = User() Alamofire.request(.POST, "myserver.com/login", parameters: parameters, encoding: .JSON) .validate() .responseObject { (response: Response<User, NSError>) in switch response.result { case .Success(let value): user.valueHandle?(value) case .Failure(let error): user

How to get response headers when using Alamofire in Swift?

大兔子大兔子 提交于 2019-12-18 15:08:49
问题 I'm using Alamofire for my Rest (POST) request and getting JSON response seamlessly. But i can access only response body. I want to get response headers. Isn't it possible when using Alamofire? Here is my code snippet: @IBAction func loginButtonPressed(sender: UIButton) { let baseUrl = Globals.ApiConstants.baseUrl let endPoint = Globals.ApiConstants.EndPoints.authorize let parameters = [ "apikey": "api_key_is_here", "apipass": "api_pass_is_here", "agent": "agent_is_here" ] Alamofire.request(

iOS 8+ framework with nested embedded framework

你说的曾经没有我的故事 提交于 2019-12-18 13:09:06
问题 I have created a custom iOS framework LoginKit. It, in turn embeds Alamofire framework underneath. In the simulator, everything works fine, but when trying to run on the device, I get the error : Dyld Error Message: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/506B47DE-804F-477F-AA90-69DF039E07FA/data/Containers/Bundle/Application/26D0CA8F-7284-42B5-8091-E5915736DCDB/Bingo.app/Bingo Reason: image not found In the