Tệp kê khai bộ nhớ cache hoạt động tốt và các sự kiện được kích hoạt trong safari trong IOS 8. Không hoạt động ở WKWebView bất kỳ ai khác giải quyết vấn đề này?WKWebView Tệp kê khai bộ nhớ cache không hoạt động IOS8
UIKit nhập khẩu
WebKit nhập khẩu
class ViewController: UIViewController {
@IBOutlet var containterView : UIView! = nil
var webView : WKWebView?
override func loadView(){
super.loadView()
self.webView = WKWebView()
self.view = self.webView!
}
override func viewDidLoad() {
super.viewDidLoad()
var url = NSURL(string:"http://html5demos.com/offlineapp")
var req = NSURLRequest(URL:url)
self.webView!.loadRequest(req)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Bộ nhớ cache ứng dụng trở lại như được hỗ trợ nếu tôi được sử dụng html5test.com
EDIT:
cửa sổ .applicationCache không trả về undefined hoặc khi lo aded từ WKWebView
console.log("Initializing Page");
if (window.applicationCache == undefined){
console.log("Application cache not suported!");
updateSplash();
}
console.log(window.applicationCache); returns: DOMApplicationCache
EDIT 2:
if (typeof window.applicationCache.update === 'function'){
console.log("Application has method update");
console.log(window.applicationCache.update); //shows swapCache() and update() methods
window.applicationCache.update();
}
window.applicationCAche.update() throws Lỗi: InvalidStateError: DOM ngoại lệ 11: Một cố gắng đã được thực hiện để sử dụng một đối tượng mà không phải là, hoặc là không còn, có thể sử dụng được nữa.
Tôi không hiểu tại sao một người nào đó sẽ downvote điều này. ApplicationCache là một tính năng chính và không thể sử dụng nó với WKWebView là một sự trở lại lớn. –
Điều này khiến tôi đau đầu. Tại sao chúng lại hỗ trợ localstorage chứ không hỗ trợ cache manifest? Bất kỳ Ý tưởng nào về cách sử dụng tính năng gốc này thay thế? Có vẻ như tôi sẽ phải lưu trữ tất cả html/css/js/images tất cả trên thiết bị ... tại sao lại là apple! – Fostah