WKWebview file downloading from blob url

Viewed 380

For an iOS project I need to download a file, from a webview that gives me a blob URL. I've handled this case for iOS 14.5- versions by injecting JavaScript inside the webview and catching the data with the WKScriptMessageHandler. For iOS 14.5+ versions, i'm using the new WKDownloadDelegate because it seems that apple is blocking any file download from a JavaScript injection. Everything is working well under Xcode 12.5 but surprisingly it's not building under Xcode 13.

I've seen that WKDownloadDelegate methods' have the @available(iOS 14.5, *) under Xcode 12.5 but these same methods have the @available(iOS 15.0, *) under Xcode 13 :

Xcode 12.5 :

@available(iOS 14.5, *)
func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String, completionHandler: @escaping (URL?) -> Void) 

@available(iOS 14.5, *)
optional func downloadDidFinish(_ download: WKDownload)

Xcode 13 :

@available(iOS 15.0, *)
func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String, completionHandler: @escaping (URL?) -> Void)

@available(iOS 15.0, *)
optional func downloadDidFinish(_ download: WKDownload)

As i mentioned above, everything is working on Xcode 12.5. But for continuous integration purpose, i need it to be working under Xcode 13.

So my question is : knowing that Apple is blocking any data downloading from a javascript injection for iOS 14.5+ version, and WKDownloadDelegate is working under Xcode 13 just for iOS 15+ versions, is there any solution to download a file from a webview for iOS versions between 14.5 and 15.0 under Xcode 13 ?

0 Answers
Related