1

I have the error above on the first request and I already tried to change the return from URL to URLConvertible?

func baseUrlWith(string: String) -> URL {
        return URL(string: Constants.Api.BaseUrl + string)!
}

func fetchVideosAlamofire(completion: @escaping ([Product]) -> ()) {
   let url = URL(string: Constants.Api.BaseUrl + Constants.Api.Feed)
   let url1 = baseUrlWith(string: Constants.Api.Feed)

   Alamofire.request(url1!,
                     method: .get,
                     parameters: nil).validate().responseJSON

   Alamofire.request(url!,
                     method: .get,
                     parameters: nil).validate().responseJSON
}

I'm using Alamofire 4.3.0

bruno
  • 2,154
  • 5
  • 39
  • 64
  • Possible duplicate of [Alamofire 4 error request 'extra argument in call'](http://stackoverflow.com/questions/41447819/alamofire-4-error-request-extra-argument-in-call) (although it does not cover the exact same issue it should cover the same subject; madly migrating into Alamofire 4.0 without reading the migration guide). Try using the same reasoning as in the answer to track which `request` method of `Alamofire` you're actually trying to call (link to Alamofire source code included in the answer); it could prove to be a valuable Swift exercise as well as a means of solving your issue. – dfrib Jan 17 '17 at 15:57
  • `URL` ? Why not using `NSUrl` ... Which version of Swift ? – Jimmy James Jan 17 '17 at 16:08
  • @JimmyJames version 3 – bruno Jan 17 '17 at 16:17

1 Answers1

1

Use a URLRequest:

var request = URLRequest(url: url!)
request.httpMethod = "GET"

Alamofire.request(request)
.validate()
.responseJSON { (response) in
    //
}
JAL
  • 41,701
  • 23
  • 172
  • 300