ionic-team / cordova-plugin-ionic-webview

Web View plugin for Cordova, specialized for Ionic apps.
Apache License 2.0
487 stars 395 forks source link

Webkit ios 16.4 enable inspection #677

Closed spoxies closed 1 year ago

spoxies commented 1 year ago

Partial/copy of https://github.com/apache/cordova-ios/pull/1300 credit to @BBosman

Platforms affected iOS

Motivation and Context With the introduction of iOS 16.4 WKWebView instances will no longer be inspectable by default.

Details: Enabling the Inspection of Web Content in Apps

Description This PR honors that change for Release builds, but explicitly sets the inspectability to YES for Debug builds by default. It also introduce an override option, so consumers can influence this decision in their own build.

melounek commented 1 year ago

yes please... found also fork doing the same thing: https://github.com/mochi-cards/cordova-plugin-ionic-webview/commit/8ed55aceeb659c16d6a6de2717c29c684c6f9222

jvjvjv commented 1 year ago

There's an additional commit from 2021 that includes specific MIME types. IS that needed to set InspectableWebview to YES? If not, it may be what's holding up the Pull Request. @spoxies may I suggest making the change from a clean branch that matches what's in production? Maybe after that we can bug whoever on the Ionic team does pull requests and get it approved.

spoxies commented 1 year ago

@jvjvjv Thanks for the heads up , not sure how/why commit 0c2e2731a6fa655a03ebb13492acb6990af0da7d is injected. Had forked directly from the ionic-team/[master] (https://github.com/ionic-team/cordova-plugin-ionic-webview/) using GH-Web.

Have reverted the injected commit for now (as multiple persons seem to be monitoring this PR all ready). The squash merge will solve it but I think the hold up is due to this repo being in hibernation.

KBEMobisys commented 1 year ago

Would be cool if we could get this fix into the next release as fast as possible. :) Can the maintainers please have a look on this?

nicholaszuccarelli commented 1 year ago

This is an important needed fix. I can't properly debug my iOS app now.

phyr0s commented 1 year ago

Hello @jcesarmobile can you check this pr please?

studentrk commented 1 year ago

As a workaround I added the following code to the function getWebView() in node_modules/@capacitor/ios/Capacitor/Capacitor/CapacitorBridge.swift I don't know if this is the correct way to do it, but after adding the lines the inspection via safari was possible again. I came across this post(https://stackoverflow.com/a/75975721/19561942).

public func getWebView() -> WKWebView? {
        if #available(iOS 16.4, *) {
            webView?.isInspectable = true
        }
        return webView
    }
jvjvjv commented 1 year ago

I just wanted to say this is the best news ever thank you giralte-ionic!

giralte-ionic commented 1 year ago

The real trick is going to be getting this to publish so please be patient

nicholaszuccarelli commented 1 year ago

Legendary.

gischy commented 1 year ago

what about ios 16.6 ? cant inspect my ionic cordova app, i tried with cordova-plugin-ionic-webview 5.0.1

bobisum commented 11 months ago

I'm facing the same issue with iOS 16.7.1

amrivero commented 8 months ago

I have IOS 17.3 and safari TP version 17.4. I can't inspect my ionic cordova application.