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
37
votes
19 answers

Alamofire No Such Module (CocoaPods)

Using Xcode 7 I am trying to install Alamofire in a sample project. Have used the instructions from Ray Wenderlich's page Only change from above link is the podfile -- which is from GitHub page here because the version has been updated. I have also…
Anuj Arora
  • 3,017
  • 3
  • 29
  • 43
34
votes
5 answers

Cancel a request Alamofire

I am sending a request which is triggered based on timer. But if I press the back button the request still seems to be active and the response in turns crashes the app. Kindly suggest a way to cancel the request. Using Xcode 8.2.1 Swift 3 Here is…
Ankit Kumar Gupta
  • 3,994
  • 4
  • 31
  • 54
34
votes
4 answers

Alamofire returns .Success on error HTTP status codes

I have a pretty simple scenario that I'm struggling with. I'm using Alamofire to register a user on a rest API. The first call to register is successful and the user can log in. The second call, when trying to register with the same email address…
Craigt
  • 3,418
  • 6
  • 40
  • 56
34
votes
4 answers

Unit Testing HTTP traffic in Alamofire app

I'm struggling a bit to figure out how to best test an app that uses Alamofire to help sync with server data. I want to be able to test my code that uses Alamofire and processes JSON responses from a server. I'd like to mock those tests so that I…
Daniel D
  • 3,637
  • 5
  • 36
  • 41
32
votes
10 answers

Alamofire Xcode 8 Swift 3 results in 786 compile errors

I am using the Xcode 8.0 GM. I created a default single-view app with my deployment target set to 9.0. In my Podfile I'm targeting the bleeding edge Swift 3 branch: source 'https://github.com/CocoaPods/Specs.git' platform :ios,…
Aaron
  • 6,466
  • 7
  • 37
  • 75
32
votes
11 answers

How to use NetworkReachabilityManager in Alamofire

I want functionality similar to AFNetworking in Objective-C with Alamofire NetworkReachabilityManager in Swift: //Reachability detection [[AFNetworkReachabilityManager sharedManager] startMonitoring]; [[AFNetworkReachabilityManager sharedManager]…
MuraliMohan
  • 1,063
  • 1
  • 11
  • 30
32
votes
3 answers

How to get the result value of Alamofire.request().responseJSON in swift 2?

I have a question about the new version of Alamofire for Swift 2 Alamofire.request(.POST, urlString, parameters: parameters as? [String : AnyObject]) .responseJSON { (request, response, result) -> Void in let dico = result as?…
Edgar Georgel
  • 602
  • 1
  • 7
  • 17
31
votes
6 answers

XCode 12: 'SessionDelegate' has different definitions in different modules

Edit: This problem occurs after XCode 12 Beta5. Xcode doesn't allow different modules to define same names (Probably for public classes & protocols). Alamofire and Kingfisher appears to define SessionDelegate at the same time. I'm still trying to…
Feridun Erbaş
  • 573
  • 1
  • 6
  • 19
31
votes
2 answers

How to assign rawValue of enum to variable with ObjectMapper?

Hello I am using Object Mapper with Alamofire in Swift and I am trying to map enum raw value to real Enum. Here is my enum and also the code I am trying to use in function mapping. Can you please help me what to pass as argument to EnumTransform or…
Radim Halfar
  • 536
  • 2
  • 6
  • 15
29
votes
3 answers

Module file was created by an older version of the compiler

Using Carthage to manage my dependencies, everything runs fine in the simulator. However, when building for a device I get the following error: Module File was created by an older version of the compiler; rebuild Alamofire and try again:…
vikzilla
  • 3,998
  • 6
  • 36
  • 57
29
votes
4 answers

How to use Alamofire with custom headers for POST request

I implemented a POST request with Alamofire with a custom header, because we work with OAuth2 and we have to send an access token in every request inside the header. In this case I have to use a custom header. The access token value for the HTTP…
Karl
  • 1,601
  • 3
  • 15
  • 13
28
votes
4 answers

POST request with data in body with Alamofire 4

how is it possible to send a POST request with a data in the HTTP body with Alamofire 4? I used custom encoding at swift 2.3 it was working good. I converted my code swift 3 and I tried to paramater encoding but not working. This code : public…
Cagatay
  • 392
  • 1
  • 4
  • 9
28
votes
3 answers

Alamofire: Follow HTTP redirects (or not)

I'm trying to configure Alamofire to follow redirects (or not) on a per-request basis. Alamofire has a private internal class SessionDelegate which serves as the NSURLSessionTaskDelegate for the current URL session. SessionDelegate does implement…
Jonathan Hersh
  • 1,073
  • 1
  • 8
  • 15
27
votes
5 answers

what is the advantage of using Alamofire over NSURLSession/NSURLConnection for networking?

Can anyone help me in understanding these question : What is the advantage of using Alamofire over NSURLSession/ NSURLConnection? What are the differences between NSURLSession and NSURLConnection?
26
votes
3 answers

post application/x-www-form-urlencoded Alamofire

I want to use Alamofire to retrieve a bearer token from Web API but I am new to ios and alamofire. How can I accomplish this with Alamofire? func executeURLEncodedRequest(url: URL, model: [String : String]?, handler: RequestHandlerProtocol) { …
Mario Dennis
  • 2,986
  • 13
  • 35
  • 50