Why can't I compile my React-native apps anymore? - ios

I'm gonna ask your guidance/help for a problem I've been encountering for several days now,
I can create a new react native project (via npx react-native init projectName), but when I try to run it, either with npx react-native run-ios or yarn ios, I get the following error message:
The following build commands failed: CompileC
/Users/user/Library/Developer/Xcode/DerivedData/Trickster-ejsutjhruuvmqjedsaarumhaquan/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/x86_64/SysUio.o
/Users/user/Dev/Mobile/React
Native/Trickster/ios/Pods/RCT-Folly/folly/portability/SysUio.cpp
normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in
target 'RCT-Folly' from project 'Pods')
I've already cleaned yarn/npm cache, cleaned Xcode's DerivedData folder, even uninstalled node and react native from my computer, so I'm kinda lost tbh.
Here are my specs:
MacBook Pro Mid 2014 with a 2.6GHz Core i5, 8Gbs of ram running macOS Monterey 12.2.1
npm version 8.5.2, 1.22.17 and Xcode 13.2.1.
Sorry in advance if I don't answer fast, I'm a bit ill atm so kinda occupying my time till I'm better

Try running Project from Xcode that will show you where problem exactly is

This problem can be for several reasons. To avoid going into so much explanation If the application worked at some point
Delete the app in the device and
run yarn android or npm android
or
delete the build folder and delete the app in the device and
run yarn android or npm android or
on Android delete and reinstall the device then
run yarn android or npm android
That's works for me

Related

flutter app runs on Android simulator but not iOS simulator

I am running a flutter app on the Android simulator successfully but when I run it on the iOS simulator the app opens to a white screen then crashes.
I have done all of the following about 10 times each.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
sudo xcodebuild -license
flutter update
flutter clean
xcode clean build folder
flutter build ios
flutter run
Remove the Pods folder and Podfile.lock files.
cd ios
pod deintegrate
cd ..
flutter clean
flutter build ios
Xcode 12.5.1
I also made sure Xcode Signing & Capabilities were set. I also stopped and removed all antivirus software.
It doesn't work by running debug and running via terminal ( flutter run --enable-software-rendering ) doesn't show any errors.
UPDATE:
Deleted the iOS folder and tried to run flutter create and now getting.
"No option specified for the output directory"
flutter create doesn't work.
Got the above flutter create working and now the app won't install on the Android device at all, where as it was working before flutter create was run (suggested below). Added memory and wiped Android simulator and still won't install on Android saying not enough memory. Deleting the ios folder and running "flutter create" was a disaster.
Rolling back to original code. Still stuck on not installing on iOS. It has to be something with Xcode.

YogaKit.modulemap not found in React Native on IOS after build in Xcode 12.4 on Macbook M1

Just make a new React Native projects on new Macbook M1. At first it was building on Xcode 12.4 with any troubles. But after a few days build failed with error:
fatal error: module map file '/Users/jocoders/Library/Developer/Xcode/DerivedData/CryptoWalletApp-hfiwvoyqlbgufkgtyvqtxygiaodf/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
What I already tried, but nothing works from it:
Checked cocoapods build target and it is the same version as my projects build target https://github.com/facebook/react-native/issues/28503#issuecomment-643744117
Rebuild a project;
Install pod with command arch -x86_64 pod install;
Put arm64 in Xcode Excluded Architectures https://github.com/facebook/react-native/issues/28503#issuecomment-770378485.
Guys can you tell me please how to solve it? Is it possible now to develop for React Native on new Macbook M1? I have it already a few weeks, but still not work on IOS, because it is so painy, a lot of errors. And I was waiting more surprises from Android more then IOS, but in real Android works with out any troubles.
All day I tried to find the decision and nothing worked to me except it: please try to open Xcode through Rosetta - Right click on Xcode in applications folder -> Get Info -> set Open with Rosetta to true
When you try to create a project using the below command in M1(Apple Silicon Chip):
npx react-native init ProjectName
Try to build using below steps:
Open Terminal and install rosetta
Type "softwareupdate — install-rosetta" command in your terminal.
After installation completes, go to the Application.
Find Terminal App
Right click and make a Duplicate Terminal
Now right click on a duplicate terminal and click on "Get Info"
You will see checkbox with option "Open with Rosetta". Enable it. Rosetta checkbox in terminal
That's it. Rename your rosetta terminal so that you can identify it easily.
Open your Rosetta Terminal and run the command npx react-native init ProjectName
After project initialisation done type npx react-native start to start metro.
Now type command npx react-native run-android for run into Android
Type command npx react-native run-ios for run into iOS.
After project initialisation is done you can run start and run command in VS Code also.
I had this problem with react-native 0.70 and xcode 14.2, and i was able to eventually get the app to run by opening the .workspace (NOT the .project xcode file) xcode file in xcode and running (the "play" button in xcode) from the root directory.
After this worked (the app succesfully ran in the ios simulator), i was able to run metro in the terminal and then run
yarn react-native run-ios
from within the ios folder of the app.
The app succesfully built and ran from terminal.
I had the same issue although not on a M1. I fixed it using all the recommendations from this answer.
Quoting the answer there for reference:
Make sure your cocoapods build target is the same version as your
projects build target.
Try rebooting your machine.
Examine your podfile to make sure your build scheme is included in it.
The last thing that really helped me was rebooting the machine. Strange!
I have got an M1 mac setup. The above methodologies were not working for me. However, this worked: Run XCode Rosetta
Finder -> Xcode in applications folder -> Get Info -> set Open with
Rosetta to true
Xcode is now under Rosetta.

Running react-native run-ios is success. but not launch simulator

I've been using ReactNative in Windows. Android is perfect and now it has to build on the iPhone and give ipa to clients.
However, even if you run counter-native run-ios after updating the code yesterday, the app will not be launched on the simulator.
I started a new project because I thought there might be a problem with my project, and then I ran a counter-native run-ios, but I failed.
The terminal is output as a successful build, but there is no response to the simulator.
App is not installed.
Somebody please help me.
react-native version is 0.59.9
Images are run on terminals and simulators.
As in latest react-native version 0.60.0 + they have fixed too many problems which are with integration of latest xCode version.
Please do the following to achieve
Upgrade react-native version to 0.60.0 or +
rm -rf node_modules/&& yarn install && react-native link
cd ios and then pod install
Close the bundle and run(Cmd+ r) from xCode
Well, in my case I was in sudo mode. When I turned it back to normal mode, it showed up on the IOS simulator as an app.

How to fix expo start throwing "Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; dont know what that is"

I am trying to set up a react-native development environment. I would like to set up an iOS emulator (preferably an iPhone 10) to run my app on. I am using a Macbook Pro 2016 running on MacOS 10.14.3. I have installed my react-native app through the command create-react-native-app (running version 2.0.2). I also have installed XCode running version 10.2(10E125). When I scan the QR code that Expo generates and run it on my iPad or my Android device it works just fine, but when I try to load the iOS emulator by pressing i after expo start it returns the error
Trying to open the project in iOS simulator...
Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; don't know what that is.
Simulator not installed. Please visit https://developer.apple.com/xcode/download/ to download Xcode and the iOS simulator. If you already have the latest version of Xcode installed, you may have to run the command `sudo xcode-select -s /Applications/Xcode.app`
I have already tried running the command sudo xcode-select -s /Applications/Xcode.app
I have also tried running the command xcode-select -r
I have also confirmed that in my XCode->Preferences->Locations Command Line Tools is selected as "Xcode 10.2(10E125)"
None of these have worked.
I am expecting that after pressing i after expo start an iOS emulator loads up. Thank you.
-----EDIT-------
After some more research, I found out that running open -a Simulator and then running expo start loads the app on an emulator and works for my purposes. But still if I just run expo start without running open -a Simulator it still gives the same error. I want to ask if this is the best I am going to get?
You might be running an outdated version of Expo. I had this problem when I was download someone's old repo using Expo 27 when Expo 36 came out. After updating to the latest version, it works.
To update packages in your project, npm-check-updates comes in handy.
npm i -g npm-check-updates # installs ncu globally
ncu -u # updates all dependency versions in your local package.json
npm install # updates the packages in node_modules to match
Note: This will update all your dependencies to the latest version. If you don't want to do this, you can find the latest version of expo and change the version in package.json manually.
I ran into the exact same problem all of a sudden. Clicking "Run on iOS Simulator" within the Expo Developer Browser worked 2 days ago but did not work today. Your clue of using open -a Simulator helped me though. I went into Xcode and clicked the Xcode menu > Open Developer Tool > Simulator. This started the Simulator and then I was able to click "Run on iOS Simulator" within the Expo Developer Browser and it worked as expected. If you haven't had the fortune of "Run on iOS Simulator" working, I'm guessing you could just start a simulator, download Expo from the App Store and just use it from there. None of this answers the question as to why the error happens but at least gives a few workarounds for anyone else that might need. All that matters is you get the app running on the Simulator in the end!

React Native app not running in XCode iOS simulator

I try to make my first steps using React Native. Development for Android (on Windows host) works. Now I wanted to test iOS, and tried to set up a development environment on a MacBook Pro.
Problem: React Native starts the iOS simulator, and then nothing happens any more. The simulator runs OK, but my React native app won't start.
What do I need to do to get my React Native installation going?
More Info:
I set up XCode and React Native according to the docs on the MacBook Pro running OSx 10.13.2 (High Sierra). XCode was installed and tested successfully, including the simulator.
When I installed Node.js I deliberately picked an older version (containing npm 4.2.0), since forums say that React Native does still have problems with npm 5. I also installed Homebrew and Watchman, like stated in the docs.
To initialize an empty project, I used
create-react-native-app HelloWorldProject
and a projet structure got created in my Documents folder.
If I finally fire up my "Hello World" test app using
cd HelloWorldProject
sudo react-native run-ios
the system responds:
Starting packager ...
Starting simulator ...
and then nothing happens. The simulator does indeed start (boot --> apple logo --> progress bar --> IOs start screen), but nothing happens afterwards.
Edit
I have given up on React Native for several reasons, I leave this question here for documentary purposes, but I cannot verify or accept any answer, I don't have a React Native development environment any more.
It's probably because you used sudo. /.expo/ is owned by root. Try to change the ownership with
sudo chown -R `whoami` ~/.expo
Refer https://github.com/react-community/create-react-native-app/issues/422
Even everything in your app seems fine, sometime you face the issue that the app is taking too much time to load either through terminal or Xcode. If there is no any other specific issue with your project, the following solution works most of the time:
Go to your app folder and then go to 'iOS' folder.
Delete 'Podfile.lock' and 'Pods' folder.
Execute the following command in Terminal from your 'ios' folder, that will bring back the 'Podfile.lock' and required Pods will be installed to 'Pods' folder:
pod install
Delete the 'build' folder in your 'iOS' folder.
Run the following command in terminal:
react-native run-ios
While the terminal is running, open '.xcworkspace' in your 'ios' folder in Xcode.
The above steps will make sure it will be build your react native project newly and will run on the simulator.
Thanks
Wasantha Wijayaratna

Resources