No Bundle URL Present
After you create a production build for React Native iOS, you might get No Bundle URL Present when reverting to development
The instructions for creating a production build for a React Native iOS app are located in the docs here, under the section Building your app for production.
However, when you go back to a development environment, you will have to backtrack your steps, or in other words, undo what you did.
The two steps for manually creating a production build are
- Enable App Transport Security
- Configure release scheme
The instructions are pretty straightforward and easy to reverse. However, I had a little trouble undoing the step Enable App Transport Security. If not done properly, you might encounter the error message below.
When resetting the NSAppTransportSecurity properly in the Info.plist file, syntax errors and their ilk are easy to evoke. I found it easiest to just cut and paste the default code back in to the Info.plist. I was using Sublime for my text editor.
Below was the default configuration in the Info.plist file when the project was created with React Native. This was the code I pasted back in to remove the No Bundle URL Present error.
<key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict>
For a good explanation of app transport security, see this article by Steve Peterson.
The Info.plist file can usually be located in your React Native project root /ios/<appName>/Info.plist. If you’re comfortable using Xcode, you can edit the Info.plist from Xcode. Lastly, this solution was only used for a manual configuration and not by React Native CLI.