HomeiOS Developmentios - Is there a wkwebkit delegate that may inform me if...

ios – Is there a wkwebkit delegate that may inform me if a consumer clicks on an add button within the loaded webpage?


I’ve a standard Swift UIViewController class that holds a WkWebView that is used all through the app, for a number of webviews. Just lately, a vendor added an iframe, {that a} consumer can navigate inside, and inside that stream there’s a file add button.

The issue is that our view has viewDidAppear() and viewDidDisappear() overrides, the place the URL will get set. E.g.:

override func viewWillAppear() {
    setUrl(selectedWorkflow) // Load particular workflow
}

override func viewDidDisappear() {
    setUrl(web page.clean) // Clear cookies, reset workflows
}

On the iPhone SE (first gen) for those who try to add a file, it opens the photograph picker full display. In case you try to Take a Photograph, it opens the digital camera app full display. Each methods, it causes the viewDidDisappear() to be referred to as when the add button is clicked, and viewWillAppear() to get referred to as when you choose the picture.

Inside these two calls the URL is reset, the web page disappears, and no file is uploaded.

I would prefer to know if there’s any strategy to detect that an add button was clicked, from throughout the WKWebView delegate, in order that I can briefly set a flag to disregard the lifecycle occasions. I would be open to even a partial thought to resolve this difficulty with out re-architecting the category to now not depend on viewWillAppear and ViewDidDisappear.

Thanks upfront.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments