dengjunwen / JWNetAutoCache

iOS web资源缓存解决方案、异步后台更新。离线缓存
MIT License
150 stars 35 forks source link

请问大佬这个有封装wkwebview的缓存demo的吗 #6

Open GrandSu opened 6 years ago

GrandSu commented 6 years ago

我是使用了这个项目和wkwebview进行使用,但是感觉兼容性不是很好,自己又不会弄这个(小萌新一枚),网上百度和谷歌没有找到更好的,感觉好绝望啊

dengjunwen commented 6 years ago

这个只能使用uiwebview。

Apaid commented 6 years ago

可以使用,不过WKWebView需要加个register去注册http和https就可以使用NSURLProtocol拦截了。

GrandSu commented 6 years ago

@Apaid 但我使用的这个项目用 WKWebView 来用,在使用登录接口的时候会出现body为空的情况,账号个密码无法post回服务器。我之前是根据简书上 https://www.jianshu.com/p/99698fcaf166 的来操作,但结果不理想

GrandSu commented 6 years ago

@dengjunwen @Apaid 请问一下现在有 WKWebView 比较成熟的缓存策略吗

dengjunwen commented 6 years ago

Wkwebview 不太了解了。在一直停留在两年前的理解。那时候的缓存方案是不成熟的。不过你可以下载到本地,加载本地的页面。这些例子网上有很多,我随便找了一个。https://blog.csdn.net/hanhailong18/article/details/79394856

在 2018年8月24日,下午12:03,远游の游子 notifications@github.com 写道:

@dengjunwen https://github.com/dengjunwen @Apaid https://github.com/Apaid 请问一下现在有 WKWebView 比较成熟的缓存策略吗

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dengjunwen/JWNetAutoCache/issues/6#issuecomment-415644585, or mute the thread https://github.com/notifications/unsubscribe-auth/ANdcazkizdK111ppGQ71Mlt9x11i3M3Pks5uT3sTgaJpZM4V6GPA.

Apaid commented 5 years ago

但是它也只是缓存方面可以,通过替换资源来实现缓存,但是网页内部跳转传参,POST请求那就不可以了。我这边还是使用了UIWebView实现的本地缓存,也支持POST请求。这是暂时的办法,WKWebView本地缓存可以,但是致命的就是POST请求问题。