I have an iOS app that gets a PDF from an S3 bucket and displayed the PDF using WKWebView.
I have changed/updated the PDF when accessing the S3 link I see the new PDF when using Android I see the new PDF
however iOS still shows the old PDF? Any Ideas?
Is there a way to clear WebView Cache? I have tried Settings clearing Safari cache I have tried setting no-cache to the S3 bucket PDF
viewController.html = "https://xxxx.s3.amazonaws.com/voucher/NEW.pdf"
let htmlData = "<!DOCTYPE html><html><header><meta name='viewport'></header><body><object width=\"100%%\" height=\"100%%\" align='center' data='\(html)'></object></body></html>"
webview.loadHTMLString(htmlData, baseURL: nil)
Thanks in advance
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
records.forEach { record in
WKWebsiteDataStore.default().removeData(ofTypes: record.dataTypes, for: [record], completionHandler: {})
print("[WebCacheCleaner] Record \(record) deleted")
}
}