Reputation: 21
I am trying to send a exPID = ["abcdef"]
is an array containing one String in Swift GET Request using :
request(URLInfo, method: .get, parameters: exPID, encoding: URLEncoding.default, headers: getHeader)
but parameters are expecting a Dictionary of String:AnyObject.
Cannot convert value of type '[String]' to expected argument type 'Parameters?' (aka 'Optional<Dictionary<String, Any>>')
I also tried getRequest.httpbody
. It is giving me error even then.
Upvotes: 1
Views: 268
Reputation: 21
Sending a String for Example "ExPID" in the http body has been outlawed for GET Request having a body. This change was called out in iOS 13.0 release notes.
https://developer.apple.com/forums/thread/123348
That's why Swift will automatically fails such request as "GET method must not have a body"
This can be done only by sending a Parameter such as key and value using AlamoFire or sending a String in POST Request.
Upvotes: 1