webxr-ios icon indicating copy to clipboard operation
webxr-ios copied to clipboard

console access

Open joshmarinacci opened this issue 8 years ago • 10 comments

When running the app from a local XCode build you can access the Javascript console by attaching desktop Safari to it. However, when running the app from the appstore you cannot access the console. I'm assuming this is due to security reasons. Given that this is a tool for developers we need to find a way to give them access to the developer console.

joshmarinacci avatar Oct 20 '17 17:10 joshmarinacci

This is an Apple restriction. There is no way to give them access to the javascript console or content. Presumably this is to prevent dastardly dastards from peeking inside apps written using web technology and stealing their secrets.

blairmacintyre avatar Oct 20 '17 17:10 blairmacintyre

True. However I'd like to leave this open to investigate workarounds. ex: let the app connect to a websocket server to report errors.

joshmarinacci avatar Oct 20 '17 17:10 joshmarinacci

Yes, I agree (that's why I re-opened this after closing it)

http://www.vorlonjs.io/ might be a reasonable solution to suggest. We've used it with Argon4, for example. It can show the console, and do some things. We (or others) can write custom plugins (e.g., we could do a Webxr plugin that shares the state of webxr and displays it graphically in the client)

blairmacintyre avatar Oct 20 '17 17:10 blairmacintyre

Perhaps as part of this issue, or a separate issue ought to be filed for this: Using Sentry/raven.js or Google Analytics for collecting JavaScript errors is a good idea.

cvan avatar Oct 23 '17 21:10 cvan

Can you give me some URLs to show me how this works? Good idea

blairmacintyre avatar Oct 24 '17 01:10 blairmacintyre

sure:

  • https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror.html
  • https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror
  • https://dev.opera.com/articles/better-error-handling-with-window-onerror/

cvan avatar Oct 24 '17 22:10 cvan

I wonder how hard it would be to simply add a console view that you can show/hide, that shows all the console output? @che1404 should we consider this? Perhaps in the debug view, there's a console button that just pops up a scrollable text view with all of the console messages?

blairmacintyre avatar Nov 28 '17 16:11 blairmacintyre

Sorry I'm not sure if it's the iOS console or the javascript console what you mean. If it's the iOS console, maybe we can use this approach, using CocoaLumberJack (that's the one we are using currently): https://egeek.me/2012/10/01/log-to-uitextview-on-ios/

che1404 avatar Nov 28 '17 16:11 che1404

I meant the Javascript console. So, grab the messages and put up a view.

blairmacintyre avatar Nov 28 '17 17:11 blairmacintyre

I think it should be doable. I'd listen from a specific event type from the javascript, as we do now for the AR data communications, and then we could add it to a UITextview.

che1404 avatar Nov 29 '17 14:11 che1404