The issue there is that "?" is not part of the path. It should be automatically added when you add the query items components of your URL:

let host = ""
let path = "/service/getData"
let queryItems: [URLQueryItem] = [.init(name: "cc", value: "al"),
                                  .init(name: "lastDate", value: "")]
var urlComponents = URLComponents()
urlComponents.scheme = "https" = host
urlComponents.path = path
urlComponents.queryItems =  queryItems
urlComponents.url?.absoluteString  // ""

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top