If my React Native XCode project’s run scheme is configured with the "Debug" build configuration, it works fine.
With the "Release" configuration, it cannot connect to the bundler (I get the "Invariant Violation" which talks about Metro not being found).
I need to test the release build as the app is crashing in TestFlight.
Is it possible to test an iOS release build on a USB connected device?
2
Answers
It came down to a mistake in my build configuration, which I'll post here on the off chance someone finds it useful.
In the main app target's "Build Phases", in the "Bundle React Native code and images" phase I had the line:
Which was supposed to be in an extension's configuration, not the main app.
It was the reason not only for the release tests not working, but also the TestFlight crash.
It is. Yeah, that’s weird. I’m sure you’ve scoped the docs, but if it were me, I would:
npm start
from the directory of your react native project.release
.If it’s still not working, a few other things I’d try:
npm start --reset-cache
release
build config. Just to rule out anything project specific.If none of that helps, let me know where you are and I’ll see if anything else comes to mind.
Best of luck