iOS 16.4 webview can not debug in safari web inspector

version: iOS 16.4(20E5239a) both on my iphone and Simulator,Safari -> develop shows "no inspectable applications"

Post not yet marked as solved Up vote post of Kingbeta Down vote post of Kingbeta
14k views
  • Also seeing this since upgrading to Xcode 16.4. Previously, it was working.

  • Are you using this to debug webpages or for webviews in an app?

Add a Comment

Replies

Made the careless mistake of updating to iOS 16.4, and now our Capacitor application doesn't appear in Safari debug. I hope this gets solved quickly!

Apparently this is by design now with iOS 16.4. You need to actually mark the webview as inspectable even while running in debug mode from Xcode. See blog post at https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/

If you're on Capacitor, there are more details and a temporary workaround here: https://github.com/ionic-team/capacitor/issues/6441

  • Yeah this is correct. I just add this normally to debug now: if #available(iOS 16.4, *) { webView.isInspectable = true; }

  • Thank you! This worked, however now I'm experiencing another issue with iOS 16.4 and the Web Inspector where console.log messages don't appear in the console anymore. Is anyone else experiencing this?

  • Setting webView.isInspectable = true allows me to open the application in the Web inspector, but I can no longer see any console.log statements printed in the web inspector console. Has anyone been able to fix this?

Installing Safari Technology Preview 16.4 on the mac to access the console from an iPhone with safari 16.4 make the console log available again. Thank you thmclellan :)

Installing Safari Technology Preview 16.4 on the mac DID NOT help me..

  • I needed both the if #available(iOS 16.4, *) { webView.isInspectable = true; } and Safari Technology preview 16.4 to view console messages

Add a Comment

Cordova team fix this bug with the release of Cordova platform iOS 6.3.0 (see Cordova blog post: https://cordova.apache.org/announcements/2023/04/15/cordova-ios-release-6.3.0.html)

If you cant update your Cordova iOS platform for any reasons, you can update yourself the CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m file. Open your project in Xcode, go to the CDVWebViewEngine.m file, search for the lines:

WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];
wkWebView.UIDelegate = self.uiDelegate;

Then add following line and save. Re build your project and it should works (solution found here)

WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];
wkWebView.UIDelegate = self.uiDelegate;

if (@available(iOS 16.4, *)) {
        BOOL allowWebviewInspectionDefault = YES;
        wkWebView.inspectable = [settings cordovaBoolSettingForKey:@"InspectableWebview" defaultValue:allowWebviewInspectionDefault];
}

I also recommend using Safari Technology Preview instead of Safari for debugging with web inspector. Good luck.

  • @iwantosee I have updated the platform to 6.3.0 and I am still unable to see my device in the safari inspect list, any further help would be appreaciated.

  • @iwantosee I have ionic 1 project, with cordova iOS platform 6.3.0 and I can't inspect iPhone 11, iOS 16.5 with Safari Technology preview Release 172 (Safari 17.0, WebKit 18616.1.17.3)

Add a Comment

Solution by @iwantosee its works for me, and with Safari Technology preview it works. Thank you so much for your Answer.