我能够将本地文件从 iTunes 文件共享(例如“index.htm”)加载到 web 视图中
我的问题在于当我尝试从搜索文本 uitextbox 打开链接时。在这里,我搜索字符串“mow now”
NSString *currentURL = [viewWeb.request.URL absoluteString];
//cleanup
NSString *match = @"Documents/";
NSString *preTel;
NSString *postTel;
NSScanner *scanner = [NSScanner scannerWithString:currentURL];
[scanner scanUpToString:match intoString:&preTel];
NSString *finalString = [NSString stringWithFormat:@"%@contents/search.htm?search=%@&menu=0&submitType=Search", preTel,fixedSpaces];
file:///var/mobile/Applications/################/contents/search.htm?search=mow+now&menu=0&submitType=Search
### = 我的 iphone 沙盒代码(我认为?)
NSString *fullURL = finalString;
NSURL *url = [NSURL URLWithString:fullURL];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[viewWeb loadRequest:requestObj];
..和页面不加载。:(