Questions tagged [alamofire]

Alamofire is an HTTP networking library written in Swift.

Alamofire is an HTTP networking library written in Swift.

Features

  • Chainable Request / Response Methods
  • URL / JSON / plist Parameter Encoding
  • Upload File / Data / Stream / MultipartFormData
  • Download File using Request or Resume Data
  • Authentication with URLCredential
  • HTTP Response Validation
  • Upload and Download Progress Closures with Progress
  • cURL Command Output
  • Dynamically Adapt and Retry Requests
  • TLS Certificate and Public Key Pinning
  • Network Reachability
  • Comprehensive Unit and Integration Test Coverage

Project

6065 questions
16
votes
1 answer

iOS 8+ framework with nested embedded framework

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:…
dudeinthemirror
  • 537
  • 4
  • 15
16
votes
4 answers

How to Connect localhost (with invalid certificate) using Alamofire?

This my first project using swift. I am usin alamofire to connect the API. I have a local copy form the API I want to use for debugging - so I can set test data - because the remote API has already real data that I can't mess with. The problem is I…
Ismail
  • 2,778
  • 2
  • 24
  • 39
15
votes
1 answer

How to build a Carthage framework from git branch

Alamofire has a bug that is fixed in a future release. The author has already fixed the bug and the solution is merged in the master branch. Is there any way for me to use carthage so I can create a framework file that includes this fix? Currently…
java_doctor_101
  • 3,287
  • 4
  • 46
  • 78
15
votes
2 answers

Alamofire 4 upload with parameters

I'm doing the below to upload a PNG file with parameters: Alamofire.upload( multipartFormData: { multipartFormData in multipartFormData.append(UIImagePNGRepresentation(tempImage!)!, withName: "file", fileName: "picture.png",…
KVISH
  • 12,923
  • 17
  • 86
  • 162
15
votes
1 answer

Does AlamofireObjectMapper / ObjectMapper support struct type mapping

I am using AlamofireObjectMapper to parse json response to my object. The AlamofireObjectMapper is a extension of ObjectMapper. According to their documents, my model class has to conform to Mappable protocol. For example: class Forecast: Mappable…
Leem.fin
  • 40,781
  • 83
  • 202
  • 354
15
votes
3 answers

alamofire.error Code=-6006 "JSON could not be serialized

Been working on this for a bit with no success. I have a function that goes to a UIButton solely to perform alamofire calls to my rails api which uses all JSON. I'm using Swift 2, Alamofire 3, XCode 7 & Rails 4 for my api which is deployed to…
James H
  • 562
  • 2
  • 7
  • 20
15
votes
2 answers

Error handling in Alamofire

I have the HTTP code in an AngularJS controller: $http.post('/api/users/authenticate', {email: $scope.email, password: $scope.password}) .success(function (data, status, headers, config) { authService.login($scope.email); …
Paymahn Moghadasian
  • 9,301
  • 13
  • 56
  • 94
14
votes
3 answers

Swift 5 & Alamofire 5 : GET method ERROR: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(22 bytes)

I am trying to get records from Database using Alamofire. I am sending parameters in GET request as below. let headers : HTTPHeaders = ["x-access-token": "\(t)","username":"\(Base.sharedManager.user)","password":"\(Base.sharedManager.pass)"] let…
Votesapp Team
  • 141
  • 1
  • 1
  • 3
14
votes
1 answer

How to use "responseDecodable" method in Alamofire?

I have been trying to use "responseDecodable" method from Alamofire, but I'm getting "Generic parameter 'T' could not be inferred" error while using it. Can someone guide me how to fix this?
Arun_
  • 1,806
  • 2
  • 20
  • 40
14
votes
3 answers

Right way to refresh the token

There is a function getUser in RequestManager class that called in my VC. func getUser(onCompletion: @escaping (_ result: User?, error: String?) -> Void) { Alamofire.request(Router.getUser).responseJSON { (response) in // here is the…
aaisataev
  • 1,643
  • 3
  • 22
  • 38
14
votes
1 answer

Using alamofire how get response as raw string

Using Alamofire library in my project. In case failure I want get all possible information from server why, not only Error object made by Alamofire, but full raw string or json. How I can get it?
zzheads
  • 1,368
  • 5
  • 28
  • 57
14
votes
3 answers

Heterogeneous collection literal could only be inferred to '[String : Any]'; add explicit type annotation if this is intentional

I have a POST body paramter like this: { "id": 0, "name": "string", "contactInfo": "string", "message": "string" } So since i am using the Alamofire for posting the parameters i am describing the post body dictionary like this: let body =…
Chelsea Shawra
  • 1,593
  • 4
  • 22
  • 43
14
votes
2 answers

Xcode : Alamofire get String response

I am new in IOS development and currently learning networking with Alamofire i am trying to make a login ... whenever the credentials are correct the .php file returns a json and i am able to get that json from Alamofire through the following code: …
Sam
  • 159
  • 1
  • 2
  • 12
14
votes
4 answers

How to pass access token to Alamofire?

I am trying to pass access token in Alamofire but getting confuse in various methods around web. Below are methods which we need to use. let todosEndpoint: String = "https:url......." let headers = [ "Authorization": "Bearer…
New iOS Dev
  • 1,937
  • 7
  • 33
  • 67
14
votes
2 answers

Alamofire 4.0 RequestRetrier should(_,retry,with,completion) not being called

I am using the RequestRetrier of Alamofire 4.0 to control the retrying of requests for expired access token. I am following the documentation here. I have a very similar implementation to the example available in the documentation OAuth2Handler…
Tamara Bernad
  • 1,048
  • 8
  • 22