doodle911 doodle911 - 1 month ago 14
Swift Question

Extra Argument In A Call

I am in need of a solution for this error, which has only occurred when I upgraded to Xcode 8!

My code looks like this;

Alamofire.request(.GET, link).validate().responseJSON { response in


the error highlights "link" in red. it is defined further above the code;

let link = "http://www.gov.je/_layouts/15/C5.Gov.Je.CarParks/proxy.aspx"


The ERROR is this;

Extra Argument In A Call


Any help is greatly appreciated!!!

Answer

According to the document:

- Data Request - Simple with URL string

// Alamofire 3

Alamofire.request(.GET, urlString).response { request, response, data, error in
    print(request)
    print(response)
    print(data)
    print(error)
}

// Alamofire 4

Alamofire.request(urlString).response { response in // method defaults to `.get`
    debugPrint(response)
}

So you need to remove .GET argument