3

EDIT:

Okay turns out this is not a problem with AppStore i ran the app from Xcode release mode and i got the same old version running on the simulator i don't know why but Xcode is not running the latest jsbundle.

now i found this question with the same problem and tried following it i ran this command: react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets and put the newly generated main.jsbundle inside /ios/ProjectName but still when i ran the code from Xcode it gives me an old version i also tried cleaning and rebuilding and removing derived data and building again with same result

i recently uploaded an app to the Apple App Store but seems to be having issues with it here's the case i uploaded the app and it got approved and says its ready for sell but when i go to the app store and download the app it is just the previous version of the app and i don't see all the new changes made on the app...this is kind of strange for me i have also uploaded a new logo on the new version release and the logo is updated..the version is also updated on the app store listing the previous one was 1.0 this one shows 1.1 and the "Whats new" section is also updated...i have also changed the preview and screenshots with this new version that is also reflected on the app store listing but only when i download the app i get the previous version.

i tried going to my app store connect and then Activity and i see my build is there with a correct uploaded date and build numbers...is there something i am missing here?

Thanks,

3 Answers 3

6

Here is a detailed trial-and-error process trying to pin down which step is crucial to resolve the issue.

I start from the code base where npx react-native run-ios --configuration Release does reflect new changes in the code base. Each subsequent round follows the previous round, i.e., the previous round's end state might affect the next round.

Round 1

  • Remove main.jsbundle from both Xcode and the file system.
  • Make changes to the react native code base.
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.

Round 2

  • Try npm start -- --reset-cache
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.

Round 3

  • Try "Cmd + Shift + K" within Xcode to clean build.
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.

Round 4

  • Run react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/your_app_name/main.jsbundle
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.

Round 5

  • In Xcode, manually add the main.jsbundle file to your app folder. In your project, right click on the folder baring your app's name, choose "Add file to your_app_name", and add main.jsbundle in the app folder. Note that the bundle we add here was created in Round 4.
  • Run npx react-native run-ios --configuration Release. In the output message during command execution, a new message shows up: "Copying /.../your_app_name/ios/your_app_name/main.jsbundle".
  • SUCCCESS, new changes are showing now. This suggests that the bundle created in Round 4 is used for this build, instead of some previous version cached somewhere.

Round 6

  • Make another change in the react native code base.
  • Directly run npx react-native run-ios --configuration Release without building the bundle manually. The copy message does not show up.
  • FAIL, new changes not reflected in the build. Note that main.jsbundle exists in both Xcode and the file system.

Round 7

  • Run watchman watch-del-all to clean cache of watchman.
  • Run npx react-native run-ios --configuration Release. The copy message does not show up.
  • FAIL, new changes not reflected in the build.

Round 8

  • Run react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/your_app_name/main.jsbundle to rebuild a bundle.
  • Without tinkering with Xcode, directly run npx react-native run-ios --configuration Release. This time, the copy message shows up.
  • SUCCCESS, the latest changes are showing now.

Conclusion

At least on my laptop, manually building an offline bundle is required for each new release build to reflect the latest changes in the react native code base. Building the bundle only works if the bundle is added to the app folder in Xcode. It seems that we only need to add the bundle to Xcode once.

Also a big caveat is that the behavior might be different with a different Xcode version.

Versions I am working with

  • macOS Catalino 10.15.6
  • Xcode 11.6
  • react-native 0.61.5
Sign up to request clarification or add additional context in comments.

Comments

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

I just generated a new main.jsbundle file with this command. Then added the file as a Copy Bundle Resource in my project on Xcode.

To add the main.jsbundle in CP Bundle Resource: I right clicked on your_app_name > Add Files to your_app_name Select the new main.jsbundle.

Then I added it to Build Phases > Copy Bundle Resources.

Finally, cleaned Build folder, re-builded and run the app (via Run button directly on Xcode).

PS : Did it with Release scheme because I wanted to test my release version not debug which works fine.

1 Comment

Using your command produces Assets destination folder not set, skipping... I've fixed it with adding --assets-dest ios. Now the command looks like: react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/project_name/main.jsbundle --assets-dest ios
1

I had the same issue and it turned out to be because it was running a cached version of the app so it got solved by doing npm start --reset-cache

1 Comment

Ow i see...but in my case the project was actually ejected from expo and whenever i made changes to my project i needed to run expo publish to update the main jsbundle file which xcode uses.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.