如何encode:
let urlStrEncode = urlStr.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
或者
let urlStrEncode = urlStr.stringByAddingPercentEncodingWithAllowedCharacters( NSCharacterSet.URLQueryAllowedCharacterSet())
顺道再贴下如何decode:
let[......]
iOS中如何对URL的param强制encode,不影响前面的http...等
Leave a reply