I am trying to hit the url whose response is:
"dbdg96t7331e150600836bc5dc026cc1649a887fc8b921b6111172db399d03566a944946e3cd13246901128413c3c9673d4e806a4v7j2yxe".
So how can I handle this string from response? Here is my code:
temp = "Resident|" + user_uid
let url = "http://api.appname.my/encodedecode.php?text=\(temp)"
Alamofire.request(url).responseJSON { (responseObject) -> Void in
print(responseObject)
}
In response I am getting this:
FAILURE: invalidURL("http://api.appname.my/encodedecode.php?text=Resident|uP6zkPihw1MPleJQ44WV1rsH1dO2")
The pipe (|
) needs to be escaped in an URL
temp = ("Resident|" + user_uid).addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!
and Alamofire.request
might expect a real URL
object
let url = URL(string: "http://api.appname.my/encodedecode.php?text=\(temp)")!