加载web view的时候 Domain=WebKitErrorDomain Code=101 “The operation couldn’t be completed. (WebKitErrorDo
2016-08-27 16:31
736 查看
原因在于进行url encode的NSString中含有未转义字符。
未转义字符有很多,空格、竖线、百分号、中文字等算作未转义字符,转义后会成为 % 之类的字符。
如果确定url中均为未转义的字符,则可以用如下方式简便的方式进行url encode
NSString *encodedString=[siteUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *weburl = [NSURL URLWithString:encodedString];
未转义字符有很多,空格、竖线、百分号、中文字等算作未转义字符,转义后会成为 % 之类的字符。
如果确定url中均为未转义的字符,则可以用如下方式简便的方式进行url encode
NSString *encodedString=[siteUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *weburl = [NSURL URLWithString:encodedString];
相关文章推荐
- iOS使用UIWebView遇到Error Domain=WebKitErrorDomain Code=101 “The operation couldn’t be completed. (WebKitErrorDomain error 101
- iOS:Error Domain=WebKitErrorDomain Code=101 "The operation couldn’t be completed. (WebKitErrorDomain
- 使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.)
- 【解决方法】Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed.
- 使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed.
- 使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.)
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLError
- iOS[问题解决] Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed.
- Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (k
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLError
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLError
- 使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.)
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLError
- 使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.)
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErro
- Xcode 5 解决 The operation couldn’t be completed. (NSURLErrorDomain error -1012.) 问题
- Xcode 5 解决 The operation couldn’t be completed. (NSURLErrorDomain error -1012.) 问题
- Xcode6 svn check out项目出现“The operation couldn’t be completed. (NSURLErrorDomain error -1012.)”的解决方案
- 错误: Error Domain=kCLErrorDomain,The operation couldn’t be completed
- Xcode 5 解决 The operation couldn’t be completed. (NSURLErrorDomain error 0.) 问题