With iOS, Action App Extension, one could run a JavaScript code against HTML. However, after quite some search on Google, I have not found any document explaining how to debug in this situation (insert a break point or simply add/view console out statement).
It's not too hard, although recently I've had an issue with the page showing up when connected to the simulator. In that case I just ended up using my phone directly. (Apparently you need to start desktop Safari after the iOS Simulator has started to inspect "remote" Simulator sessions)
Settings->Safari->Advanced->Web Inspector
is onStart MobileSafari on your device by running from Xcode and choosing Safari -- this isn't necessary but you can decode the iOS Objective-C/Swift code as well. You can just start MobileSafari manually and it will be visible in desktop Safari.
Start Safari on your desktop, make sure Show Develop menu in menu bar
is on in Preferences
.
Develop
menu you will see your device name, say 'BSharer's iPhone'You are now debugging that device page on your desktop.
There are options to 'Automatically start debugger etc...', but I've found that when I tried these my code would not execute.
You can't place debugger statements in the app extension JavaScript as it isn't injected until your App Extension starts. Instead I would add a debugger;
statement to my app extension JavaScript code which will pause the debugger in the app extension JavaScript code at the debugger;
statement.
Start your app extension by selecting it in the Share
menu, set any other breakpoints you are interested in, then hit the continue button on the debugger.
You will also catch uncaught exceptions of course.
The official documentation for this is here.
Make sure you remove the debugger;
line from production code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With