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

5803 questions
130
votes
13 answers

How to parse JSON response from Alamofire API in Swift?

Following code I have written and I am getting response in JSON also but the type of JSON is "AnyObject" and I am not able to convert that into Array so that I can use that. Alamofire.request(.POST, "MY URL", parameters:parameters, encoding: .JSON)…
Developer
  • 6,033
  • 12
  • 54
  • 90
120
votes
12 answers

Swift. Could not build objective-c module 'Alamofire'

Fresh vanilla submodule install of Alamofire, using XCode6 and following directions to a T. Something here just isn't fitting right. The error i'm getting is "Could not build objective-c module "alamofire" on import alamofire. Here is a screen shot…
stopshinal
  • 1,801
  • 4
  • 16
  • 24
117
votes
11 answers

Swift Alamofire: How to get the HTTP response status code

I would like to retrieve the HTTP response status code (e.g. 400, 401, 403, 503, etc) for request failures (and ideally for successes too). In this code, I am performing user authentication with HTTP Basic and want to be able to message the user…
GregT
  • 2,074
  • 2
  • 18
  • 15
106
votes
13 answers

How to send a POST request with BODY in swift

I'm trying to make a post request with a body in swift using Alamofire. my json body looks like : { "IdQuiz" : 102, "IdUser" : "iosclient", "User" : "iosclient", "List":[ { "IdQuestion" : 5, "IdProposition":…
Stranger B.
  • 7,456
  • 21
  • 60
  • 101
98
votes
21 answers

Alamofire invalid value around character 0

Alamofire.request(.GET, "url").authenticate(user: "", password: "").responseJSON() { (request, response, json, error) in println(error) println(json) } This is my request with Alamofire, for a certain request it sometime works, but…
Lord Vermillion
  • 4,916
  • 13
  • 61
  • 99
98
votes
11 answers

Uploading file with parameters using Alamofire

I am attempting to upload a file using Alamofire. The upload works fine when using a File (NSUrl), however, I cant seem to figure out how to use the NSData option? This is what I have as a test: var url:NSURL =…
user3432352
  • 999
  • 1
  • 7
  • 7
91
votes
21 answers

Cocoapods + Cannot load underlying module for 'x'

I am running XCode 7, Swift 2.0, iOS 9. I want to install Alamofire in my project using Cocoapods. I have done the following: gem install cocoapods pod setup pod init Updated Podfile to: # Uncomment this line to define a global platform for your…
user5319603
89
votes
13 answers

IPv6 App Store Rejection

Our update has been rejected twice today for ipv6 network connectivity issues. Our networking code has not changed between the previous release and this current release. The app only makes https network requests to api.metooapp.io, which is…
88
votes
12 answers

POST request with a simple string in body with Alamofire

how is it possible to send a POST request with a simple string in the HTTP body with Alamofire in my iOS app? As default Alamofire needs parameters for a request: Alamofire.request(.POST, "http://mywebsite.com/post-request", parameters: ["foo":…
Karl
  • 1,451
  • 3
  • 12
  • 13
80
votes
3 answers

AlamoFire asynchronous completionHandler for JSON request

Having used the AlamoFire framework I've noticed that the completionHandler is run on the main thread. Im wondering if the code below is a good practice for creating a Core Data import task within the completion handler: Alamofire.request(.GET,…
TheM00s3
  • 3,519
  • 3
  • 25
  • 58
79
votes
6 answers

Proper usage of the Alamofire's URLRequestConvertible

I've read couple tutorials, README from @mattt but can't figure out couple things. What is the proper usage of URLRequestConvertible in real world API? It looks like if I will create one router by implementing URLRequestConvertible protocol for all…
OgreSwamp
  • 4,392
  • 3
  • 31
  • 52
78
votes
6 answers

Module 'Alamofire' has no member named 'request'

I'm new to iOS Development, I installed Alamofire as said in README, but I have this error as other users and I don't know how to solve it.
user3579107
  • 1,239
  • 2
  • 10
  • 14
69
votes
1 answer

NSURLSession concurrent requests with Alamofire

I'm experiencing some strange behaviour with my test app. I've about 50 simultaneous GET requests that I send to the same server. The server is an embedded server on a small piece of hardware with very limited resources. In order to optimize the…
Hannes
  • 3,553
  • 2
  • 34
  • 43
67
votes
19 answers

Failed to load Info.plist from bundle

Cannot run app. Failed to load Info.plist from bundle error occurs. When I CMD+K clean the project, it runs fine. But I have to clean the project every time I make changes and run the app. Following is the screenshot of my podfile:
Chanchal Raj
  • 3,787
  • 2
  • 35
  • 45
67
votes
9 answers

Sending json array via Alamofire

I wonder if it's possible to directly send an array (not wrapped in a dictionary) in a POST request. Apparently the parameters parameter should get a map of: [String: AnyObject]? But I want to be able to send the following example json: [ …
fruechtemuesli
  • 2,719
  • 3
  • 15
  • 15
1
2 3
99 100