1

I built an app that runs well on iOS Simulator. When I try to build it on an iOS device however, the build and installation succeeds but upon open, I get this message:

No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.

RCTFatal

__28-[RCTCxxBridge handleError:]_block_invoke

I've now tried on three devices so device isn't issue. So far I've: 1) deleted iOS build folder and rebuilt 2) npm installed 3) cleaned xCode data 4) Restarted every process several times

One thing I've noticed is that the React Packager doesn't bundle index.js at the end of the build like it does when I run Simulator. This may be the core of the problem but I'm not sure how to approach fixing it.

I've also read that using React-Native-Router-Flux (which I do) may have some impact on this process, but also not sure what relevant fix would be.

Thanks!

Mike Collins
  • 4,108
  • 1
  • 21
  • 28
Michael C
  • 153
  • 1
  • 7
  • Does this answer your question? [What is the meaning of 'No bundle URL present' in react-native?](https://stackoverflow.com/questions/42610070/what-is-the-meaning-of-no-bundle-url-present-in-react-native) – Andrew Jun 22 '23 at 12:36

3 Answers3

2

I got it resolved by including the below code in Info.plist file which I had removed from the production build.

<key>NSExceptionDomains</key>
    <dict>
  <key>localhost</key>
  <dict>
    <key>NSExceptionAllowsInsecureHTTPLoads</key>
    <true/>
  </dict>
</dict>
jsina
  • 4,433
  • 1
  • 30
  • 28
0

See if one of the solutions here works. You may have deleted the build folder and rebuilt, but these answers seem to suggest that killing all React-Native sessions before deleting and rebuilding might work.

What means of no bundle URL present in react-native?

https://github.com/facebook/react-native/issues/12754

https://www.google.com/search?client=safari&rls=en&q=No+bundle+URL+present.&ie=UTF-8&oe=UTF-8

It helps to include references to StackOverflow articles/issue threads you've already tried and didn't work.

Aaron
  • 400
  • 3
  • 14
  • Hey...thanks for response. My bad on not including threads I've referenced. I tried the suggestions in this thread previously and just tried again. No difference. I think the key variable here is that Simulator builds fine. It's just when I build to a device that no bundle url is found – Michael C Apr 01 '18 at 19:21
  • Oh, no problem! Just a friendly suggestion :) – Aaron Apr 01 '18 at 19:24
  • Appreciate it. Any thought on what (an xCode setting for example) might be causing the difference between local build and device build? – Michael C Apr 01 '18 at 19:28
-1

Comment this line in Appdelegate.m

jsCodeLocation = [[RCTBundleURLProvider sharedSettings]jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

Use this line

 jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 

Then run a command for making a jsbundle :-

 react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

Hope it will helps you.!

Kartik Shah
  • 866
  • 5
  • 19