开发者

Problem space in UIWebView

开发者 https://www.devze.com 2023-01-31 19:06 出处:网络
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 happ

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];

0

精彩评论

暂无评论...
验证码 换一张
取 消