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,
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
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
Related
Here's a rundown of the issue:
I am running my project on the Xcode simulator, everything is fine.
I switch to a new branch to update react native. I run npm install and pod install.
I try building it, it fails, no problem, there are some kinks to work out.
I commit the changes I made, I'll come back to it later.
I switch back to the first branch and now the build fails with the same errors that I was getting on the new branch.
I haven't made any changes to the first branch, git log is the same as it was before, why is this happening?
Both are now failing in Android Studio too, though with a different error.
Xcode errors:
ENOENT: no such file or directory – I think this is because of a space in my path. It wasn't an issue before I did the update but if I fix that, I get:
The sandbox is not in sync with podfile.lock (What is the sandbox? I wonder if this is the issue?)
Android Studio Errors:
Gradle sync failed: Plugin with id 'maven' not found
The issue isn't the errors, I can find solutions to those, the issue is that it was working, nothing changed, and now it's not working.
I've run into this two times. The first time I read forums for hours and tried all that I could but the only thing that helped was deleting my local repo and pulling down a new one from the remote. But, it'd be nice to not have to do that every time I update something.
Has anyone run into this?
Here're some specs if helpful:
Xcode: 13.2.1
MacOS: Monterrey 12.2 (Intel)
Macbook Pro, 16G
React Native on first branch: 0.65.1
React Native on new branch: 0.67.4
Android Studio: Bumblebee| 2021.1.1 Patch 2
Node on first branch: 12.19.1
npm on first branch: 6.14.15
Node on new branch: 16.14.0
npm on new branch: 8.3.1
Many thanks in advance!
The issue is probably that changes were made to files that are in your gitignore, possibly the Podfile.lock and within node_modules. When switching back to your original branch, you'll have to run yarn / npm install again, and then pod install. The "sandbox" error occurs when the contents of the Pods directory is out of sync with what is prescribed in the Podfile.
If you've already done that, try stopping your Metro instance and running npx react-native-clean-project. There are several caches that could need to be invalidated or refreshed: native builds, Metro, gradle, watchman, etc.
all. I am having a hard time creating a project that can build and run. I can create normal iOS react-native projects without issue, but I don't understand the instructions for the tvos setup. Can someone please explain or simply tell me what lines to enter into the terminal? I am currently creating react native apps using npx (like npx react-native init myproject, npx react-native run-ios etc).
Here are some resources: https://facebook.github.io/react-native/docs/building-for-apple-tv
This one says "The RNTester app supports Apple TV; use the RNTester-tvOS build target to build for tvOS.". I don't know what "RNTester app" is, or how to "use RNTester-tvos build target".
Also, I don't understand anything here: "https://github.com/react-native-community/react-native-tvos"
It's been a while you posted but I had the same issue and finally figured it out:
Depending on your react-native-cli version you can do:
react-native init TestApp --version=react-native#npm:react-native-tvos#latest
or
react-native init TestApp --template=react-native-tvos#latest
TestApp is the name of your App
https://developer.aliyun.com/mirror/npm/package/react-native-tvos
I'm trying to publish my first React Native app in App store and when I'll build in Xcode:
Product > Archive
appears some error, but i already have main.jsbundle
main.jsbundle does not exist. This must be a bug with
echo 'React Native
Screen Error:
You can generate a new main.jsbundle using this command.
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
Run this command in your project directory.
In my case, I was able to fix the issue by removing main.jsbundle from Bundle Resources.
Open react native project in xcode
Check if Copy Bundle Resources build phase contains main.jsbundle
If it contains, remove it and build again
Clear watchman watches:
watchman watch-del-all
Delete node_modules:
rm -rf node_modules and run yarn install
Reset Metro's cache:
yarn start --reset-cache
Remove the cache:
rm -rf /tmp/metro-*
In Xcode, you should be able to find the main.jsbundle inside the Xcode project sidebar.
If it isn't there, then you should drag the main.jsbundle into your Xcode project (in the default template app you can find it at ios/main.jsbundle)
If it is in there, but red - then you need to build a copy of the main.jsbundle which you can do via react-native bundle (and some additional args which you can look up.
I was getting the error because of a bug in the code, instead of using simulator I was using Xcode to install a release build to my device which led to this error.
To fix this, run the app on the simulator make sure it builds and runs properly and then install it on your device.
Try this instead
Go to Xcode
Go to targets
Select Build phases from the top
Just remove main.jsbundle lib from Copy Bundle Resources in build phase
re-run again.
My Flutter Project won't run on the ios simulator and is throwing this error:
Launching lib/main.dart on iPhone Xʀ in debug mode...
Running Xcode build...
Xcode build done. 7.6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Could not build the application for the simulator.
Error launching application on iPhone Xʀ.
The xcode error was also as follows:
/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
I've already tried running flutter doctor and there were no errors.
I also tried re-rooting my xcode 'FLUTTER_ROOT' and 'FLUTTER_APPLICATION_PATH' in build settings, which did not work.
after a lot of messing around, I set these two settings and the build ran on to my physical device.
Goto Xcode,
click on Runner
select Project (top one)
go to Info tab
change configurations for debug
top Runner (green icon) to Generated
Bottom Runner (red circles) Pods-Runner-debug
Basically what happens is that one of the project's 'Build Phases' is running a script:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
Now in order to find xcode_backend.sh the FLUTTER_ROOT variable needs to be defined. It is defined in a file called Flutter/Generated.xcconfig, which is generated when you run flutter pub get or flutter build.
The build configuration files Debug.xcconfig and Release.xcconfig (in the same Flutter folder) include Generated.xcconfig.
Now the only thing left is to ensure that for each of the project configurations these build configuration files are properly set (in XCode under Project > Info > Configuration).
use this settings:
Open Xcode - Click on Runner(Top one)
Select the Runner from "PROJECT" Not from "TARGETS"
Select configuration
And update all the modes as this photo
Open Xcode
Click on Runner(Top one)
Select the Runner from "PROJECT" Not from "TARGETS"
Select configuration
And update all the modes for ex: In debug select "debug" configuration set
By Setting FLUTTER_ROOT as the Flutter sdk path solved this issue for me.
Setting runner to Generated in project->Info Configurations seemed to fix it. I can build in xcode now.
The simple solution was to call
flutter clean
flutter run
and then run the app from Xcode.
If changing the configuration as suggested above doesn't fix things
In your Build Phase scripts / Xcode Project change
$FLUTTER_ROOT/packages/flutter_tools/...
to
${FLUTTER_ROOT}/packages/flutter_tools/...
Did the trick for me after the upgrade to the new version of flutter broke the Build.
i have this intermittently while setting up flavors havent got an answer on fixing it but the best explanation of the trail is here https://github.com/flutter/flutter/issues/49495
What helped me was going under PROJECT -> Info -> Configurations
setting the following:
Debug:
Runner - None
fRunner - Debug
Release:
Runner - None
fRunner - Release
Profile:
Runner - None
fRunner - Generated
What worked for me was:
Removing my project ios folder.
(Save it elsewhere, as you will probably want to keep your Info.plist file and Podfile.)
Run flutter create . to build a new ios folder.
Replace new Info.plist and Podfile with originals.
(If you have firebase in your app as I did you likely will have to go into xcode and right-click on runner, add files to runner, and add your GoogleService-Info.plist)
flutter clean , flutter run
I tried all solutions but no one worked :( , I think there is a something missing in the flutter folder so the fast simple solution is ;)
delete flutter folder
Download the stable branch straight from GitHub instead of using an archive (url: https://docs.flutter.dev/get-started/install/macos)
git clone https://github.com/flutter/flutter.git -b stable
Verify that the flutter/bin directory is in your PATH by running
echo $PATH
flutter upgrade
flutter config enable-ios
flutter config enable-android
flutter doctor --android-licenses
flutter doctor -v
cd path/your_project_name
flutter run ios -t lib/main.dart
I eject project from expo with command npm run eject. It generates 2 folders ios and android. I tried to run the project by xcode but it still display this error. Maybe I'm not clear how to run project after eject, can you help me run it.
I run some statements to install pod, but cannot work https://github.com/CocoaPods/CocoaPods/issues/2303
So with ejecting, you should have been presented with two options:
? How would you like to eject from create-react-native-app? (Use arrow keys)
❯ React Native: I'd like a regular React Native project.
ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
If you chose the first (React Native), then there should have been no issues with opening up your Xcode project and running the app (there would also be no pods to install). Since your error and comment indicates otherwise, I can presume that you chose option 2: Expokit.
For that, you should have been prompted with something about making an Expo account or using an existing one:
? How would you like to eject from create-react-native-app?
React Native: I'd like a regular React Native project.
❯ ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
An Expo account is required to proceed.
? It appears you're already logged in to Expo as ...
After that, you'll need to follow the steps in Developing With ExpoKit. Specifically to get iOS running, you need follow all of the steps in this section after running npm run eject.
If you've done all of that, then it should work fine when running in conjunction with Expo XDE or exp. I've just tested both right now and it works without error. Double check your steps to make sure you didn't miss something. Otherwise, please edit your question with more details on exactly what commands you ran, what other dependencies you have, etc. as I'm unable to reproduce the error you have.
If you want to download new project without expo then try run:
react-native init ProjectNameHere
or , If you want to convert your own project without expo then try :
1. rm -rf node_modules
2. remove expo dependencies from package.json
3. npm install
4. react-native upgrade
(Note:This following step will create new ios and android folder and you have to redo the dependencies. I was struggling with the same issue so I posted my solution)