FAQ Database Discussion Community


Alamofire request JSON

json,swift,alamofire
I need to make a request to the following JSON { "usuario": { "nmeUsuario": "name", "username": "TestUsername", "senha": "46070d4bf934fb0d4b06d9e2c46e346944e322444900a435d7d9a95e6d7435f5" }, "sistemaId": "2", "contatos": [ { "desContato": "[email protected]", "idTipoContato": { "idTipoContato": 1 } } ] } I tried the following code let senha = "46070d4bf934fb0d4b06d9e2c46e346944e322444900a435d7d9a95e6d7435f5" let usuario = ["nmeUsuario":"name","username":"TestUsername","senha":senha] let idContato...

NSMutableURLRequest setValue:forHTTPHeaderField xcode 6.2 not working for “application/json; charset=utf-8”

ios,xcode,utf-8,http-headers,alamofire
I am developing and app, with Alamofire, in Xcode 6.2, and by default Alamofire has this for .JSON encoding: mutableURLRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") However, I need value to be like this: mutableURLRequest.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type") The problem is that after this line, if I print allHTTPHeaderFields, I have: (lldb) po mutableURLRequest.allHTTPHeaderFields!.description...

CocoaPods not installing Alamofire in Swift Parse Chat App

xcode,swift,parse.com,cocoapods,alamofire
I am trying to compile and run the following application (Swift Chat App using Alamofire). https://github.com/huyouare/SwiftParseChat I am using ruby-2.0.0 , cocoapods 0.37.1, xcode 6.3, Alamofire 1.2.0 I am installing it using the normal <pod install> command. No errors or warnings during the process. However, when compiling, I get: No...

How to implement self signed certificates in Alamofire?

ios,swift,alamofire
I write a swift based app with a self signed certificate server communication. As a network library I want to use Alamofire. However Alamofire doesn't support self signed certificates. Is it possible to implement this feature easily and how?...

Bridge Swift to Objective-C library “ono” using cocoapods

objective-c,swift,ios8,cocoapods,alamofire
For my swift iPhone app I'm needing to parse XML. I'm using Alamofire and trying to use Ono which is an objective c library. I used cocoapods to install Alamofire & Ono. I've followed the steps here: How to integrate Cocoapods with a Swift project? where I have #import <Ono/Ono.h>...

Synchronizing remote JSON data to local cache storage in iOS Swift

ios,json,swift,caching,alamofire
I am trying to find the solution for simple processing all necessary steps for read-only consuming remote JSON data on iOS devices. It means fetching remote JSON data, store to local cache on iOS device for offline usage, refresh the cache, parsing JSON data. I think it is very common...

inserting row into UItableView error

ios,iphone,uitableview,swift,alamofire
I Have tableView that gived data from url api by 10 items. When it scroll to down I try to get next 10 items and insert them into row. So in viewDidload I get Alamofire.request(.GET, urlQuery, parameters: ["universityId": UBUniversitySettings.getUniversityId(), "page" : currentPage, "pageSize" : 10]).responseJSON{ (request, response, JSON, error) in...

Swift Alamofire SwiftyJSON Asynchronous/Synchronous Class Methods

swift,asynchronous,synchronous,alamofire,swifty-json
So I currently have the following: class ViewController: UIViewController { class Identity{ let baseUrl = "superSecretURL" var _username: String = "" var _password: String = "" var _apiKey: String = "" init(){ } init(username: String, apiKey: String){ _username = username _apiKey = apiKey } init(username: String, password: String){ _username =...

Proper model for multiple Alamofire requests for multiple websites

swift,alamofire
I am using Alamofire to scrap web pages for some data, let’s say News. News is a generic object with something like title, content, picture, date, author etc. However for each web site, I use different method. For some I use json for others I use hpple to extract the...

error when using Alamofire to download an image

ios,swift,alamofire
Trying to make a fix in a pre-existing project with Alamofire but I am getting an error. The code in question is: Alamofire.request(.GET, "https://www.domain.com/demo-mobile-images/dogs-blue.jpg" ).response { (request, response, data , error) in tableViewCell.backgroundImageView.image = UIImage(data: data, scale:1) } but I get error: Cannot invoke 'response' with an argument list of...

Handle unknown content-type of response with Alamofire

ios,json,swift,content-type,alamofire
I use Alamofire to do requests to a rest service. If the request is successful the server returns a JSON with content-type application/json. But if the request fails the server returns a simple String. So, I don't know how to handle on it with Alamofire, because I don't know how...

Swift ios alamofire data returning empty first time in viewDidLoad

ios,swift,api,model-view-controller,alamofire
I am trying to load data from an API into my viewcontroller but the first time it loads the data returns empty import UIKit class AdViewController: UIViewController { var adId: Int! var adInfo: JSON! = [] override func viewDidLoad() { super.viewDidLoad() loadAdInfo(String(adId),page: 1) println(adInfo) // This shows up as empty...

SwiftyJSON: Update Cells in UITableView from JSON response

ios,json,uitableview,alamofire,swifty-json
I'm pretty new to iOS Development so please be gentle. I am using the Alamofire and SwiftyJSON libraries for a project to get and parse a JSON file that is on a server. I also have used this tutorial to get a UITableView with a few cells "Cell 1" "Cell...

Create JSON Object from Class in Swift

swift,alamofire,swifty-json
I'm pretty new to iOS development and Swift (so please bear with me). I have a class object defined like this: class LocationPoint { var x: Double var y: Double var orientation: Double init(x: Double, y: Double, orientation: Double) { self.x = x self.y = y self.orientation = orientation }...

Swift - Call segue inside of a closure

ios,objective-c,swift,segue,alamofire
I am trying to call a segue inside of a closure and I can't seem to make it work. The problem is that I don't know how to make the "performSegueWithIdentifier" call since I cannot use the keyword "self" here. This is being done outside of UIViewController, so I don't...

Alamofire POST request with progress

ios,ruby-on-rails,xcode,swift,alamofire
I'm using Alamofire to do a POST request. As this POST request can take a while and I want to keep track of the progress and display it as a ProgressView. Alamofire.request(.POST, ApiLink.create_post, parameters: parameters, encoding: .JSON) .progress { (bytesRead, totalBytesRead, totalBytesExpectedToRead) -> Void in println("ENTER .PROGRESSS") println("\(totalBytesRead) of \(totalBytesExpectedToRead)")...

Alamofire.request vs. manager.request - manager not working

ios,swift,alamofire
EDIT: the question was not about what -999 means, but why do I not get an error with the first code fragment, but with the second? Apart of using the Alamofire.Manager in the second code snippet (that should work identical to the Alamofire.request in the first code snippet), everything is...

Converting JSON from AlamoFire/SwiftyJSON to Dictionary in Swift/Xcode

xcode,swift,alamofire,swifty-json
My head is going to explode :) - I've been trying to get a JSON String from my server to a Dictionary Value, and I can't get it to work. I'm trying to get (from my Server - this is dynamic and I want my app to be able to...

Swift: How to use library: Alamofire-SwiftyJSON

swift,alamofire,swifty-json
I'm having trouble trying to get this library Alamofire-SwiftyJSON (https://github.com/SwiftyJSON/Alamofire-SwiftyJSON) to work. I created a new project and downloaded the Alamofire-SwiftyJSON library and dragged everything into my project navigation area. However when I go into the ViewController and add: import AlamofireSwiftyJSON I get the error: no such module import AlamofireSwiftyJSON...

bug compiling alamofire - unknown option character `X' in: -Xlinker

ios,iphone,swift,alamofire
Trying to add alamofire to a project using cocoapods. Xcode version: Version 6.1.1 (6A2008a) Podfile: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'OAuth.io' pod 'Alamofire', '~> 1.1' Here's the error: Libtool /Users/tony/Library/Developer/Xcode/DerivedData/Candytone-aynufizixrzmtwgatrvrjynlonxv/Build/Products/Debug-iphonesimulator/libPods-Alamofire.a normal x86_64 cd /Users/tony/src/candytone-ios/Candytone/Pods export IPHONEOS_DEPLOYMENT_TARGET=8.1 export...

Alamofire Nested JSON Serializer

json,swift,alamofire
I am using Alamofire to make requests to a JSON API. I am trying to serialize a collection of Post objects that have an author object and a comments array inside of it. Click to see the hosted JSON I have done the following: Step 1: Follow steps Extended the...

Module 'Alamofire' has no member named 'request'

ios,alamofire
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. ...

What are Embedded Binaries in Xcode?

xcode,xcode6,alamofire
I'm using Alamofire in a Swift project, and part of their manual installation instructions are to add Alamofire under Embedded Binaries in the General tab for my application target. What are Embedded Binaries?...

Alamofire nonblocking connection

swift,alamofire
I am using Alamofire for basic networking. Here is my problem. I have a class class User { var name:String? var company:String init () { // manager = Alamofire.Manager(configuration: configuration) } func details () { //first we login, if login is successful we fetch the result manager.customPostWithHeaders(customURL!, data: parameter, headers:...

How to use swiftyjson to parse json data to foundation object and loop through data

swift,alamofire,swifty-json
So I'm trying to get his raw json data and use it to ultimately be viewed in a table(so one table cell would be --> Emirates - $1588.77) Problem: Having trouble parsing the JSON data.. alamofire apparently does it automatically? but im completely confused with the data types. I keep...

Alamofire : How to handle errors globally

ios,swift,networking,alamofire
My question is quite similar to this one, but for Alamofire : AFNetworking: Handle error globally and repeat request How to be able to catch globally an error (typically a 401) and handle it before other requests are made (and eventually failed if not managed) ? I was thinking of...

Downloading and parsing json in Swift with Alamofire

ios,json,swift,alamofire
Sorry I am quite new to this and they're may be something glaringly obvious that is going over my head but I am getting the following error message with this code: "fatal error: unexpectedly found nil while unwrapping an Optional value." var jsonReceived = Alamofire.request(.GET, getJsonURL).responseJSON { (request, response, jsonData,...

How to handle multiple network call in Alamofire

swift,alamofire
I need to call 2 apis in a view controller to fetch some data from server, I want them to start at the same time, but next step will only be triggered if both of them are returned(doesn't matter it's a success or failure). I can come up with 2...

Chain multiple Alamofire requests

ios,swift,alamofire,promisekit
I'm looking for a good pattern with which I can chain multiple HTTP requests. I want to use Swift, and preferrably Alamofire. Say, for example, I want to do the following: Make a PUT request Make a GET request Reload table with data It seems that the concept of promises...

Alamofire not sending upload-request (no connection established at all)

ios,swift,upload,alamofire
I want to upload a file, which has recently been downloaded (in my app) from the DocumentPicker (e.g. iCloud, Dropbox, ...) So I have the NSUrl (urlToFile) of this file (verified) I use this code to upload: upload(.POST, Config.uploadURL, urlToFile!) .progress { (bytesWritten, bytesWrittenInTotal, bytesToBeWritten) -> Void in println("Bytes: \(bytesWrittenInTotal)")...

iOS - API Synchronization

ios,swift,core-data,grand-central-dispatch,alamofire
I'm building a toy app in iOS where the user can: Create tasks, stored locally Those tasks will be synced to the server Create tasks in a web page They will be synced back to the app All of this using Core Data for persistence and Alamofire for networking, coded...

Archive validation failed with errors during app store distribution process

ios,swift,xcode6,ipa,alamofire
I have been trying to send my application to apple for submission and it is my first experience about it. I have searched the errors and applied all suggested solutions. However none of the solutions didn't work for me. I got the error below. I set the ios deployment target...

iOS: (Swift) How to show distance from current location and exist annotation on annotation subtitle

ios,swift,annotations,mapkit,alamofire
I am currently working on map application base on iOS using Swift language. I would like an suggestion because after I plot all the pins on map view (which I receive data from my server using JSON frameworks call Alamofire) I would like the subtitle of all annotations on map...

How to install properly Alamofire SwiftyJSon and Alamofire-SwiftyJson

swift,alamofire
Has you can see from my previous questions, I got a lot of trouble parsing JSON Data. After few days of headache with that, I think the best way still to use alamofire/swiftyjson. I also found the alamofire-swiftyjson to let everything working well together. But I am not sure how...

Alamofire “installation” not working (red text in Embedded Binaries)

ios,xcode,swift,xcode6,alamofire
I am trying to add Alamofire to my xcode v6.3.2 project but it's not working for me. I followed all the steps in the readme from the github repo but when I select the framework to add as an "Embedded Binary" it shows with red text and is not available...

Compiler error in custom Alamofire response function

ios,swift,alamofire
I'm attempting to implement a generic responseObject function for Alamofire using Argo. Unfortunately I'm getting a persistent compiler error: error: missing argument for parameter #2 in call APIManager.manager.request(APIRouter.Login(username: usernameTextField.text, password: passwordTextField.text)).responseObject { (object, error) -> Void in I understand this error to usually mean something about tuples, so I'm guessing...

Swift: Using Alamofire and SwiftyJSON with a paged JSON API

json,swift,alamofire
Using Alamofire and SwiftyJSON to retrieve some JSON is trivial: Given JSON such as { "results": [ { "id": "123", "name": "Bob" }, { "id": "456", "name": "Sally" } } This function will work: func loadSomeJSONData() { Alamofire.request(.GET, "http://example.com/json/") .responseJSON { (_, _, data, _) in let json = JSON(data!)...

iOS - Asynchronous requests and UI interactions

ios,swift,asynchronous,uicollectionview,alamofire
I have a page that uses Alamofire to retrieve images from Google Image Search API and display them inside a collectionView. Everything works, but when the request is still loading I can't interact at all with the UI, whether it's clicking a button or scrolling the collectionView. Is this normal...

Issues with calling a function that has to wait for a server response

ios,json,swift,alamofire,completionhandler
So I have the following code in my view controller that works perfectly. I make the json request, the server call is made and I get the response no issues. My function is called on a button click: @IBAction func buttonClick(sender: AnyObject) { var postsEndpoint = "http://test.com/test" let test =...

Alamofire RED in Xcode project - No Alamofire.framework file

ios,xcode,swift,xcode6,alamofire
I'm trying to install Alamofire into my Xcode project. However, after following all the steps for installation given by the documentation on the github project, the Alamofire.framework file shows as red in Xcode, and the project will not build. Further, there seems to be no way to fix this, because...

How to check Alamofire request has completed

ios,swift,alamofire
I am developing an iPad application using Swift. For http requests I use Alamofire library. So far I have managed to pull some data from an API. But the problem is since it is an asynchronous call I don't know how to check whether the request has completed. Any help...

Stubbing HTTP Requests in Swift [closed]

ios,unit-testing,swift,alamofire,nocilla
I am using Swift for an iOS app, and using Alamofire to perform HTTP requests. I want to write unit tests to cover my functions, but I'm having trouble stubbing the HTTP requests performed by Alamofire. I am using Nocilla (imported into bridging header) to try to stub my HTTP...

saving a photo and using it straight away swift - webservice

ios,swift,camera,photo,alamofire
I have the following code for taking a photo and saving it to the camera roll. I need to be able to use it there and then after saving without having to go back into the gallery and selecting it. I haven't found any examples on how to do this....

How to handle ios data from API call

uitableview,swift,alamofire,swifty-json
When i call api using Alamofire like this Alamofire.request(.POST, "http://localhost:8080/xxx/xxx/xxx/xx").responseJSON() { (_, _, jsonData, error) in if error == nil{ var newItem=JSON(jsonData!) println(newItem) } else{ println("Nothing!") } } And I got many json format which include {"header","body"}. Header are like this "header" : { "toPage" : "3948", "totalCount" : "59212",...

Alamofire Accept and Content-Type JSON

ios,json,swift,alamofire
I'm trying to make a GET request with Alamofire in Swift. I need to set the following headers: Content-Type: application/json Accept: application/json I could hack around it and do it directly specifying the headers for the request, but I want to do it with ParameterEncoding, as is suggested in the...

How should i handle Alamofire response in shouldPerformSegueWithIdentifier?

swift,segue,uistoryboard,uistoryboardsegue,alamofire
I am trying to learn Swift and what i am trying to do is to create simple login page. Whenever user click on login button, i make a request to my web service in shouldPerformSegueWithIdentifier in order to check if username and password is correct. I dont want to use...

UIProgressView progress update very slow within AlamoFire (async) call

swift,uiprogressview,alamofire,nsnotification,dispatch-async
Inside an AlamoFire get request I'm trying to update my progress bar. Like so: alamofireManager.request(.GET, urlPath, parameters: params).responseJSON{(request,response,JSON,error) in ...<code here>... dispatch_async(dispatch_get_main_queue(), { NSNotificationCenter.defaultCenter().postNotificationName(LoginVCHideSpinnerAndShowProgressBarName as String, object: self) }) ...<more code here>... } For some reasons this takes a few seconds to execute and if I use dispatch_sync instead the...

Need your help, IOS Swift Post data to Json Alamofire

php,swift,alamofire
I have a textlbabelfield in which I get data from my external database through JSon. Now, I would like to let my user to modify this field and post it to the database. But again, it doesn't work, the database did not change. Please could you review my code: PHP...

AFNetworkActivityManager for AlamoFire?

afnetworking-2,alamofire
AFNetworking allows one to do: [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; But I have not figured out how to do this with the Swift AlamoFire equivalent. I've searched the source for some of the same terms, but don't see anything yet. (I'm learning Swift, so be gentle)....

How to create an API like Alamofire does in Swift?

ios,swift,alamofire
In the Alamofire.swift file the main API functions are not nested within a class or struct: import Foundation ... public func request(method: Method, URLString: URLStringConvertible, parameters: [String: AnyObject]? = nil, encoding: ParameterEncoding = .URL) -> Request { return Manager.sharedInstance.request(method, URLString, parameters: parameters, encoding: encoding) } yet they are able to...

Is there a failed block for Alamofire?

ios,swift,alamofire
I'm using Alamofire with Swift kind of this way: Alamofire.request(.GET, urlString) .authenticate(usingCredential: credential) .response { (request, responseJSON, data, error) in [..and so on] Now I wonder how I can execute some code in case the server is e.g. completely down. Something like a failed block in ObjC. I know that...

Accessing the error in Alamofire causes EXC_BAD_ACCESS

ios,swift,alamofire
In my iOS app I have an UIVieController with a text field which sends a request each time the value is edited. The point is to show the user suggestions which are returned from the server as a JSON object. I initially had all Alamofire requests run freely but to...

Alamofire Priority Queue

ios,swift,queue,alamofire
I am using Alamofire as my networking library for my Swift app. Is there a way to keep a "priority queue" of network requests with Alamofire? I believe I saw this feature in a library in the past but I can no longer find it or find other posts about...

Alamofire + Swift in UICollectionView

ios,json,swift,xcode6,alamofire
I had no idea how to parse JSON data using Alamofire. Right now I successfully request the data from web service. The problem is I'm not really sure how to embed/parse json (image) data into UICollectionView import UIKit import Alamofire class PopularViewController: UIViewController,UICollectionViewDataSource, UICollectionViewDelegate { var users: [AnyObject] = []...

iOS: doubts about Alamofire vs AFNetworking

ios,swift,afnetworking-2,alamofire
now I'm starting a new app Universal (min versione iOS 7) and I want use Switf (it's my second app with this new language) In this app I need the framework AFNetworking, but I have some doubts about compatibility with the new version Alamofire. I know that there are some...

Why can't I get the request result form Alamofire

json,swift,alamofire
I can't get the result of Alamofire request.So,I created ouput of an array that I got from json async call.I can't get the resultArray out of dispatch {...}.When I add println to debug the code.The second one appear first before the first one. All i want to resultArray to get...

error calling functions in swift with a JSON response

ios,json,swift,alamofire
Could anyone else help me to know which is the way to call functions in swift, receiving a JSON collection response? I'm calling ApiClient().getList() function in viewController.swift,this function calls to my API and receives a JSON response in apiClient.swift and finally I would like to assign this JSON response to...

iOS8/Swift strange null behaviour with response from REST service

ios,rest,swift,alamofire
Throughout my project I can perfectly check Alamofire responses and data for if fooData != nil { //do stuff } somehow in this instance Swift seems to have problems checking what the actual incoming type is what I get if I print it is <null> what is this supposed to...

Try to serialize Object although Validation fails

swift,alamofire
I use ResponseObjectSerializable like described here: https://github.com/Alamofire/Alamofire#generic-response-object-serialization And i want to validate if the status code is in a range https://github.com/Alamofire/Alamofire#validation My call looks like this: Alamofire.request(Router.Something()) .validate(statusCode: 200..<300) .responseObject { (request, response, object:Object?, error) in println(object) println(request) println(response) } My Problem is if the validation fails responseObject anyhow get...

Swift Async Alamofire return

swift,asynchronous,alamofire
I'm getting an empty value on return annotations, I am sure this is because of the async scope, Ive tried everything to get var annotations: [TestAnnotation] = [] to return the values but I can't. The loop is correctly appending the values within the makeRequest scope. func makeRequest(url : String,...

Handling XML data with Alamofire in Swift

ios,xml,swift,alamofire
I started to use cocoapods with my current ios project. I need to use SOAP to get content with easy way for my ios project. I have googled it and Alamofire pod is great for me. Because I am using Swift programming language. I have inited easily this pod. But...

Creating generic fetcher using Alamofire JSOn and HTML

json,swift,alamofire
I am trying to start a project based on web scrapping. I have the tools already setup for different platforms for JSON I use SwiftyJSON and for raw HTML I use hpple. My problem is I am trying to setup some generic class for content and some generic class for...

how to add json object to dictionary

swift,alamofire,swifty-json
when i create output with Alamofire using SwiftyJSON Alamofire.request(.POST, "http://localhost:8080/ws/automobile/global/auction/latest/venues").responseJSON() { (request, response, jsonData, error) in var venues = JSON(jsonData!) println(venues) } it appear like this in console { "C2058" : [ "LAA Okayama" ], "C2062" : [ "NAA Osaka" ], "C2035" : [ "JU Ibaraki" ], "C2526" : [...

returning a value from a function with Alamofire and SwiftyJson

swift,alamofire,swifty-json
I have an app that returns a menu of information (basically menus, menu_headers, and items). I'd like to have something like this: EKMenu.getMenu(menu_id: Int) that would return a menu but I think I would need a completion handler in here. I currently have: class func getMenu(menu_id: Int){ //class func getMenu(menu_id:...

Proper usage of the Alamofire's URLRequestConvertible

ios,swift,alamofire
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 API - it will be barely readable. Should I create one...

Alamofire breaks other pods

cocoapods,alamofire
When I add alamofire to my Podfile it breaks all the others. I think it's because of the frameworks thing? Basically where I used to have this in my bridging header: #import <AFNetworking.h> now it says it can't find AFNetworking.h Does that for all of the headers that I get...

Swift/PHP How to display mysql data (json) in UITableView using Alamofire

php,json,swift,alamofire
I would like to create a TableView which return just one cell. Include in this cell three labels: id, username and category. This would result to let user to see his basic detail info. When I Run the APP, my UITableView still not showing any result (blank). Please anyone can...

building objects from json response using NSJSONSerialization

json,swift,alamofire
Using swift 1.2, xcode 6.3 and IOS 8, Im trying to build an object from a json response using NSJSONSerialization class. the json response is: [{ "_id" : "5470def9e0c0be27780121d7", "imageUrl" : "https:\/\/s3-eu-west-1.amazonaws.com\/myapi-static\/clubs\/5470def9e0c0be27780121d7_180.png", "name" : "Mondo", "hasVip" : false, "location" : { "city" : "Madrid" } }, { "_id" : "540b2ff281b30f3504a1c72f",...

Error handling in Alamofire

ios,angularjs,swift,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); $state.go('home'); }) .error(function (data, status, headers, config) { $scope.errorMessages = data; $scope.password = ""; }); In the success case, the server will respond with a JSON representation of a...

How do I pass header field token in Alamofire with Swift?

api,swift,laravel-4,http-headers,alamofire
I'm developing an application and it connects to my API. I'm using Alamofire library for http request and I already know how to login. Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["username": "mier", "password": "marlon"]) .response { (request, response, data, error) in println(request) println(response) println(error) } In order to get the data of the...

Why is not recommended to modify session configuration for authorization headers in Alamofire?

swift,alamofire
From: https://github.com/Alamofire/Alamofire Modifying Session Configuration ... example code ... This is not recommended for Authorization or Content-Type headers. Instead, use URLRequestConvertible and ParameterEncoding, respectively. Ok, I will not use it, but why it is not recommended for handling Authorization headers?...

Multiple encoding types for Alamofire Request

alamofire
I need to make a POST request with an HTTP Body with a JSON object, but I also need to use url query parameters in the same request. POST: http://www.example.com/api/create?param1=value&param2=value HTTP Body: { foo : [ bar, foo], bar: foo} Is this supported by Alamofire? How would I go about...

How to use Alamofire with custom headers for POST request

swift,post,header,afnetworking,alamofire
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 header field Authorization...

AlamoFire asynchronous completionHandler for JSON request

swift,alamofire
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, "http://myWebSite.com", parameters: parameters) .responseJSON(options: .MutableContainers) { (_, _, JSON, error) -> Void...

String is not convertible to String:AnyObject

swift,nsurlrequest,alamofire
I am trying out the Alamofire helpers for networking with my server. I am building up a router for handling my API endpoints. The construction itself seems clear to me, but I am struggling with some SWIFT syntax. enum Router:URLRequestConvertible { static let baseURLString = "url" case AEDS var URLRequest:...

SwiftyJSON - no access to JSON data

swift,alamofire,swifty-json
I'm trying to parse server response produced by following code (api for rails app developed with grape) if user.persisted? return user.to_json else error!(user.errors.to_json, 400) end When user submit wrong data i see following response from server: { response = "{\"email\":[\"is invalid\"],\"password\":[\"is too short (minimum is 8 characters)\"]}"; "response_type" = error;...

Download Image Using Alamofire and Save to Application Support on Mac

cocoa,swift,nsfilemanager,alamofire
The Alamofire readme indicates that you can download and save a file like this: let destination = Alamofire.Request.suggestedDownloadDestination(directory: .DocumentDirectory, domain: .UserDomainMask) Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destination) ...but I want to change the location where it is saved. How do I alter .DocumentDirectory to be my app's Application Support path on Mac...