Ios 编码包含表情符号图标的URL

Ios 编码包含表情符号图标的URL,ios,url,encoding,urlencode,nsurl,Ios,Url,Encoding,Urlencode,Nsurl,无法准备字符串包含表情符号图标的NSURL对象 当我尝试使用以下方法形成NSURL时: let urlString=”http://www.example.com/Good 问题!我目前正试图找出一个更通用的解决方案,但与此同时,您可以使用让escapedString=urlString.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLFragmentAllowedCharacterSet())并创建url

无法准备字符串包含表情符号图标的
NSURL
对象

当我尝试使用以下方法形成
NSURL
时:


let urlString=”http://www.example.com/Good 问题!我目前正试图找出一个更通用的解决方案,但与此同时,您可以使用
让escapedString=urlString.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLFragmentAllowedCharacterSet())
并创建url
让url=NSURL(字符串:转义字符串!)