Problem space in UIWebView
In practice I have a button that sends the request to a URL to a UIWebView eg: tel:124324 4563, but unfortunately it does not load the page because there is a space. How do I remove the space? as happens in Mobile Safari that I开发者_开发技巧 replace it with %20?
Thanks
The easiest way is:
[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
As documented here.
- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
You can use [myString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
精彩评论