I have a valid URL for google maps , which if you run in your browser would show an image of a map. However, when I put it inside my Swift code and try to create an NSURL from S
It should work: Here is why http://www.url-encode-decode.com
let url = NSURL(string: urlString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!)
Since above API is deprecated alternative approach is
let url = NSURL(string: urlString.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())!)