0

This is the culprit string and paramter name=solsssㅗ

 Alamofire.request(todoEndpoint)
            .responseJSON { response in
                // check for errors
                guard response.result.error == nil else {
                    // got an error in getting the data, need to handle it
                    print("error calling GET on \(todoEndpoint)")
                    print(response.result.error!)
                    DispatchQueue.main.async
                        {
                            self.activityView.isHidden = true
                            self.activityView.stopAnimating()
                    }
                    return
                }

So I get error in URL always as invalid. If I use it without any special character it works fine.

iOS
  • 5,450
  • 5
  • 23
  • 25
  • I think you have to convert the special character : https://stackoverflow.com/questions/48093256/url-encoding-of-string-accepting-all-special-characters-in-swift – Amit Aug 13 '18 at 06:03
  • Parameters to url’s need to be url encoded, this is to iliminate possible colision of reserved characters often found in url’s such as ‘?, $, /‘ Url encode/decode the url before submitting/reading. – Wayne Aug 13 '18 at 06:23

1 Answers1

1

You can try this with String url -

let urlWithSpecialCharacter = url.addingPercentEncoding( withAllowedCharacters: .urlQueryAllowed)
shivi_shub
  • 1,018
  • 1
  • 7
  • 15