Something I found out recently while trying to get console.log
messages out of webviews on React Native apps, turns out I never needed a custom onMessage event handler, and a script hijacking the console methods to replace them with postMessage’s instead. Guess what? Safari can connect to webviews and let you do your developer things on them! Let’s put the excitement aside, and explain this step by step:
- Let developer tools menu always be visible on the Safari menubar, by activating “Show features for web developers” checkbox

- Open the screen containing the webview you want to debug on IOS simulator
- Click Safari to make its menu visible on the top menubar

- Click Developer > Your simulator name > The webview title

VoilĂ ! You just have your debugger attached to that nasty webview that hides its secrets from you!
Big kudos to this person answering the question, and his friend telling him how to do it here: https://stackoverflow.com/a/20233054/916000
Happy coding!