the operation could't be completed(webkitErrorDomain error 10
来源:互联网 发布:七天网络阅卷成绩查询 编辑:程序博客网 时间:2024/05/21 11:07
NSString *pathStr= [link stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
經過實作之後,確定是可以用的。
經過實作之後,確定是可以用的。
参考:
NSString *pathStr= [link stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL* url =[NSURL URLWithString:pathStr];
NSLog(@"%@",url.host); //原本 host 是解析不出來的,現在可
以 NSURLRequest* urlReq = [ NSURLRequest requestWithURL:url ];
[ webView loadRequest: urlReq ];
今天遇到一個問題,就是網站如果使用MVC的開發模式,我們會遇到這樣類似的網址:"http://domain.com/25067/看完好想去旅行!青春18車票海報"。網頁的title塞到網址的最後面,這樣的做法雖然有利於SEO,但是 UIWebView 的 WebKit 去會把它當做是不合規格的網址,沒有辦法讀進網頁,會出現以下的錯誤訊息:Error Domain=WebKitErrorDomain Code=101 "The operation couldn’t be completed. (WebKitErrorDomain error 101.)以下是我的暫時的解決方式:1.先判斷網址是否能夠連網。2.如果不行,把網址最後的網頁title給拿掉。
NSString *link=@"http://domain.com/25067/看完好想去旅行!青春18車票海報";
NSString *pathStr=@"";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:link]]) {
pathStr=[NSString stringWithString:link];
}else {
NSMutableArray *aryx=[[NSMutableArray alloc] initWithArray:[link componentsSeparatedByString:@"/"]];
[aryx removeLastObject];
for (int i=0; i<</span>[aryx count]; i++) {
pathStr=[pathStr stringByAppendingString:[NSString stringWithFormat:@"%@/",[aryx objectAtIndex:i]]]; } }
NSURL* url = [NSURL URLWithString:pathStr];
NSURLRequest* urlReq = [ NSURLRequest requestWithURL:url ];
[ webView loadRequest: urlReq ];
- the operation could't be completed(webkitErrorDomain error 10
- iOS:Error Domain=WebKitErrorDomain Code=101 "The operation couldn’t be completed. (WebKitErrorDomain
- Xcode运行出现:The Operation couldn't be completed.(LaunchServicesError error 0.)
- iOS-the operation could`t be completed(launchServicesError error 0.)
- Error The operation couldn’t be completed. (Cocoa error 516.)
- the operation could not be completed(NSURL ErrorDomain error -999.
- 加载web view的时候 Domain=WebKitErrorDomain Code=101 “The operation couldn’t be completed. (WebKitErrorDo
- The operation couldn't be completed.(Cocoa error 256)
- The operation couldn’t be completed. (OSStatus error -43.)
- The operation couldn’t be completed. (Cocoa error 513.)
- The operation couldn’t be completed. (Cocoa error 4.)
- The operation couldn’t be completed. (LaunchServicesError error 0.)
- The operation couldn’t be completed. (LaunchServicesError error 0.)
- The operation couldn't be completed (LaunchServicesError error 0.)解决办法
- [iOS]The operation couldn’t be completed. (LaunchServicesError error 0.)
- The operation couldn’t be completed. (LaunchServicesError error 0.)问题解决
- The operation couldn’t be completed.(LaunchServicesError error 0.)解决方法
- 解决The operation couldn’t be completed. (LaunchServicesError error 0.)
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 114: invalid continuation byte
- SimpleDateFormat is Case Sensitive
- 题目72:Freckles
- 寒假刷题之6——迷宫
- CCS编译链接库文件与头文件
- the operation could't be completed(webkitErrorDomain error 10
- 上百个Android开源项目分享
- Java中replace()、replaceFirst()和replaceAll()区别
- ThinkPHP学习笔记(十四)上传文件
- iPhone开发【十四】多线程开发之NSThread——子线程模拟耗时操作
- dlmalloc解析连载(2)
- linux 分析 ptrace()
- hibernate 配置连接oracle 11g数据库时Dialect的选择问题求教
- 前端开发工程师如何在2013年提升自己