Debugging GLView on iOS

I am trying to debug code that is using the GLView and rendering some basic content but my content is never rendered when debugging. On iOS when I enable remote debugging in the Expo app the function I provide to onContextCreate is never called. Using the inspector I confirmed that the GLView is still present and there are no exceptions being thrown.

I tried this using both a device and the iOS simulator and both had the same result. When remote debugging is disabled everything works fine and my content is rendered. Is this expected behavior?

I was able to reproduce this issue using example code from the GLView documentation in apps created from both create-react-native-app and exp init.

I don’t have an android device to test with so I don’t know if this scenario works better on that platform.

1 Like

Hey! Unfortunately GLView is not compatible with the current way debugging works. :confused: It’s because remote debugging runs your JS code on a remote JavaScript interpreter (like Chrome’s) while GLView-related WebGL calls try to directly access native through JavaScriptCore which only works when running in the device runtime.

1 Like

I also just spent a bunch of time struggling with this, not realizing it was expected to not work. Would be great if there was a mention of this in the GLView docs.

1 Like

I second @bjvanminnen 's comment.

This was pretty painful, and took a few hours to realize that the GLView worked just fine when remote debugging is disabled in Expo client.

@nikki, should we open an issue? If so, where would be the place to do this (i.e. do you know where source code is for GLView, and/or if there are plans support debugging + GLView?) Also, would it be appropriate to submit a pull to the GLView doc page to let others know? Thanks!

Is there any update on this? I’m looking to make heavy use of GLView in my expo app but I’m worried about debugging the RN code that interacts with it.

Hi! I couldn’t find an outstanding feature request for this, so I opened one. Please upvote there if this affects you!