Cordova iOS Simulator Safari Web Inspector

How do I see the web view within Safari Web Inspector when running Cordova iOS ( meteor run ios) app from Simulator? So far I have added the preference:

App.setPreference('InspectableWebview', true, 'iOS')

…but still when I try to check in Safari - No inspectable applications.

Did you do this: How to Inspect Element on iPhone

I have web inspector showing for physical device and it’s working ok, it is just for simulator it does not show. I have read multiple comments about Cordova showing and not showing it in some of its versions and distributions, and iOS version 16.4 popped up multiple times as well as suggestion to use the preference.

So what you’re saying is that you can not show the inspector for the simulator unless you use SauceLabs? Would be very unfortunate…

There was an issue on cordova where the webview wasn’t inspectable. It’s related to this issue here: Mark the webview as inspectable in iOS 16.4 · Issue #1301 · apache/cordova-ios · GitHub.

If you are using Meteor 2.13 you will need to update to 2.14 to be able to inspect with safari (cordova-ios was update for this version, which includes the fix for this). Just a note is that cordova on 2.14 is also broken, so you will need to apply the workaround described on this issue: `GCDWebServer` missing in `cordova-plugin-meteor-webapp` · Issue #12946 · meteor/meteor · GitHub if you decide to update.

However, if you don’t want to update the meteor version, you can edit the generated xcode project and add the lines of code from this PR Set webView.inspectable to true for debug builds on iOS >= 16.4 by BBosman · Pull Request #1300 · apache/cordova-ios · GitHub to the CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m file.

2 Likes

Man, you are my savior! You literally summarised all the bits of info I got from different sources (including problems with 2.14 as well). I will try to set it up (in either way), hope it will work, but in any case I owe you at least a beer. :vulcan_salute:

@matheusccastro The second PR link is duplicate of the first link btw, could you please update?
And also, would you be so kind to explain how do I “pin the the plugin version to 2.0.0 on the cordova-plugins file” for the 2.14 solution?

@vblagomir Good catch, updated the PR link on my last post :slight_smile:

To pin the plugin version, you can either run meteor add cordova:cordova-plugin-meteor-webapp@2.0.0 or add cordova-plugin-meteor-webapp@2.0.0 manually to your cordova-plugins file.

Success! I have both Cordova and Web Inspector working in Simulator on Meteor@2.14! :tada:
Thank you again @matheusccastro

1 Like