首页新闻找找看学习计划

UIWebView 代理方法 webview:shouldStartLoadWithRequest:navigationType: 自己给参数加东西是什么情况?

0
[待解决问题]

UIWebView 代理方法 webview:shouldStartLoadWithRequest:navigationType: 自己给参数加东西是什么情况?

我需要加载 H5 的文件在代理方法中拦截,但是发现在代理方法 webview:shouldStartLoadWithRequest:navigationType:
(NSURLRequest *)request 参数request.URL 自己给我加内容了

比如:

加载的正确request.URL 是:

file:///Users/chendehao/Library/Developer/CoreSimulator/Devices/5F462EF6-08B4-4D88-B17D-A524AD9879E0/data/Containers/Data/Application/9B6BEE36-44BC-47F7-A095-2A613F8ED0AE/Library/Caches/p_html/package/dealer-analysis/dealer-customer-type/goView({"isTrue":true,"urlPort":"package/dealer-choice-component/dealer-choice.html","param":""})

结果在(NSURLRequest *)request 参数里得到的是错误参数

file:///Users/chendehao/Library/Developer/CoreSimulator/Devices/5F462EF6-08B4-4D88-B17D-A524AD9879E0/data/Containers/Data/Application/9B6BEE36-44BC-47F7-A095-2A613F8ED0AE/Library/Caches/p_html/package/dealer-analysis/dealer-customer-type/goView({"isTrue":true,"urlPort":"package/dealer-choice-component/dealer-choice-component/dealer-choice.html","param":""})

在花括号中的参数正确的应该是:

"urlPort":"package/dealer-choice-component/dealer-choice.html"

变成了错误的:

"urlPort":"package/dealer-choice-component/dealer-choice-component/dealer-choice.html"

发现需要加载最终文件 dealer-choice.html 所在的文件夹多加了一层dealer-choice-component


在比如:

加载的正确request.URL 是:

file:///Users/chendehao/Desktop/p_html/package/chat/goView({"isTrue":true,"urlPort":"package/chat/chat.html","param":""})

结果加载成错误request.URL

file:///Users/chendehao/Desktop/p_html/package/chat/goView({"isTrue":true,"urlPort":"package/chat/chat/chat.html","param":""})

在花括号中的参数正确是这样的:

"urlPort":"package/chat/chat.html"

变成了错误的:

"urlPort":"package/chat/chat/chat.html"

发现需要加载最终文件 chat.html 所在的文件夹多加了一层chat文件路劲
也就是将 chat/chat.html 变为了 chat/chat/chat.html


CD豪的主页 CD豪 | 菜鸟二级 | 园豆:202
提问于:2017-01-20 12:06
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册