WKWebViewDownloadHelper
WKWebViewDownloadHelper copied to clipboard
WKDownloadHelper dependancy is not available
I opened this source code using Xcode 12.5. I got following error message and code is not working.
Dependencies could not be resolved because 'WKDownloadHelper' contains incompatible tools version (5.5.0) and root depends on 'WKDownloadHelper' 0.2.3..<1.0.0.
How can I resolve this issue?
Hi, update to the latest WKDownloadHelper package version 0.2.6, I created it with Xcode 13 beta and forgot to change the Package.swift to use swift-tools 5.4 instead of 5.5, so it only worked with Xcode 13
@gualtierofrigerio Hi, Thank you for your quick response. I realized the issue. However, I tried to download the file as blob URL using the following web page. https://wkwebview-download.glitch.me/
I was able to download data and blob URLs files on iOS 14.5 device. I tried to download the same using iOS 13 device. But I was able to download only data URL file using your source code. It didn't work for Blob URL file. Do you know the reason for that?
I think it doesn't work because WKDownloadHelper tries to download the file via URLSession.downloadTask and providing a URL starting with blob: returns an unsupported URL error. One solution could be to remove the blob part from the URL and convert it to a data url or handle this in javascript. This is a possible solution https://stackoverflow.com/questions/45065085/how-to-read-a-blob-data-url-in-wkwebview In 14.5 Apple added a new API to download files, so I use a different implementation and blob seems to be supported there, there is no need to use a dataTask.
Hello. I tried way with XMLHttpRequest, but on iOS does not work. For android it works. Maybe you have another way for download blob on iOS < 14.5?