After updating to Alamofire 4 and updating my code to Swift 3, all of my requests are not working for some reason. The variables that I am trying to utilize are highlighted
You need to add as? [String: Any]
Alamofire.request(yourURL).responseJSON { (response) in
switch response.result {
case .success:
if let JSON = response.result.value as? [String: Any] {
let message = JSON["message"] as! String
print(message)
}
case .failure(let error):
// error handling
}
}
I had similar problem, for me solution was to change it as below
let urladdress = "https://api.github.com/users"
Alamofire.request(urladdress).responseJSON(completionHandler: {
response in
print(response)
})