Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试对 NSString 进行 URL 编码,但似乎找不到正确的方法(我是 Obj C 的新手)。我一直在寻找,但找不到一个像样的答案。所以:
像 URL 一样对 NSString 进行编码的正确且现代的方法是什么?
提前致谢。
编码为 UTF-8:
NSString *strUTF8 = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];