Aldo Lazuardi
Aldo Lazuardi

Reputation: 1948

Alamofire 4.0.0: [String:String] is not convertible to [String : Any] & Request is ambiguous without more context

I'm updating Alamofire to 4.0.0 Beta 1 and XCode 8 to Beta 6. First, I got [String:String] is not convertible to [String : Any] error with this code

let parameter = [
        "scope":"\(scope)",
        "client": "\(clientId)"
    ]
Alamofire.request(link, withMethod: .POST, parameters: parameter, encoding: .json).responseJSON

and after I change add [String:Any] to parameter, the error gone but create new error : Expression type 'Request' is ambiguous without more context

let parameter:[String:Any] = [
        "scope":"\(scope)",
        "client": "\(clientId)"
    ]

Upvotes: 3

Views: 820

Answers (2)

Alpha
Alpha

Reputation: 307

replace the .JSON with .JSONEncoding.default

Upvotes: 0

Aldo Lazuardi
Aldo Lazuardi

Reputation: 1948

turns out methods are now lower case, so use .post instead of .POST

https://github.com/Alamofire/Alamofire/issues/1423

Upvotes: 3

Related Questions