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.
在实践中,我有一个按钮将请求发送到 UIWebView 的 URL,例如:tel:124324 4563,但不幸的是它没有加载页面,因为有一个空间。如何删除空间?就像在 Mobile Safari 中发生的那样,我用 %20 替换它?
谢谢
最简单的方法是:
[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
如此处所述。
- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
您可以使用[myString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[myString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];