Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging React Native apps in background

While testing a release build of our React Native app on iOS, we discovered a defect with an input component that only occurred after the app had been in the background for a longer time (e.g. 1h). Presumably, this occurs after the app has been suspended by the OS.

I'm now trying to debug this issue, but when I run the app on a test device in debug mode and connected to the React Native Debugger, turn the screen off for some time and then bring the app back to the foreground, it will show a red screen with Runtime is not ready for debugging. error. This does not happen when I immediately bring the app back to the foreground after turning the screen off, so I suppose it's also related the app being suspended.

We're using React 16.3.0 and React Native 0.54.0 (preparing an update in a separate branch).

Can anyone help me understand what's going on here, and provide a suggestion on how to debug this issue?

like image 262
lackodan Avatar asked Nov 17 '22 01:11

lackodan


1 Answers

Could you use something like Sentry for bug reporting? Not only does it log JavaScript errors, but native crashes too. This is great for seeing continuous errors encountered by your users, whilst in production.

You could also run a production build and debug it via USB.

Navigate to Product > Scheme > Edit Scheme. Ensure you've selected Production in the Build Configuration. Also select Debug Executable.

Once the application launches, go to View > Debug Area > Activate Console. You should now see any native logs from your app.

like image 105
Dan Avatar answered Mar 23 '23 04:03

Dan