Failed to run react native project on IOS Simulator - ios

enter image description hereI'm new to react native, I'm following the official React native's website to init a new project, try to run IOS. But, failed with the error below.
React-Native version 0.59
XCode 10.2
error Failed to build iOS project. We ran "xcodebuild" command but it
exited with error code 65. To debug build logs further, consider
building your app with Xcode.app, by opening HelloWorld.xcodeproj
When I run react-native run-ios --simulator="iPhone 7"
Error as below:
info Command PhaseScriptExecution failed with a nonzero exit code
info
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening HelloWorld.xcodeproj

Starting the simulator : Once you have your React Native project initialized, you can run react-native run-ios inside the newly created project directory. If everything is set up correctly, you should see your new app running in the iOS Simulator shortly.
Specifying a device : You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is "iPhone X". If you wish to run your app on an iPhone 4s, just run react-native run-ios --simulator="iPhone 4s".
The device names correspond to the list of devices available in Xcode. You can check your available devices by running xcrun simctllist devices from the console.

In my case, I was specifying a simulator, but I had a different simulator open. Targeting the one that was opened, or simply closing it fixed the issue.

try this and see if it works or not.
first go to to ios folder of the project in terminal.
for that you can use terminal in visual studio code.
cd ios then
pod install
go back (to app directory)
cd ..
npm install
npm start
take a new terminal then,
npx react-native run-ios

Related

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.

React Native Can't build iOS device from command line

In order to build react native on iOS, I used the following command on the command line (VSCode) and I've tried to use the following command on the command line (VSCode) to build react native iOS and it doesn't work.
react-native run-ios --device "device name"
The application is installed successfully, but it is not reflected in the actual device.
info Installing and launching your app on "iPhone"
success Installed the app on the device.
I did this site as well as referring to it, but it didn't work.
[https://stackoverflow.com/questions/38495793/run-react-native-application-on-ios-device-directly-from-command-line]
I'd like to implement an iOS actual device build with VScode.
If you know of a similar situation or how to deal with it, please let me know.
[Version information]
react-native: 0.61.5
VSCode 1.51.0
Xcode 12.1
iOS 14.1

App is not installed using react native command

I have react native cli application and when I tried to run it on simulator using npx react-native run-ios command it builds app successfully, bundler gets started and it shows 100% complete of bundler process but on simulator app is not being installed.
Note: simulator opens automatically but app not installed. When I use Xcode to run app it is working fine
Can you please help me with this.
Video
Thanks
Finally I get it working by clearing all cash using DevCleaner(From app store) also deleted all core simulators and added few again. I specified name of simulator as well with command as npx react-native run-ios --simulator="iPhone 11"

Cordova builds iOS app and opens emulator but doesn't install

I'm making an iOS app in Cordova on MacOS.
When I run cordova emulate ios the app builds and it opens the emulator for iPhone X iOS 11.4 but it never install the app in the emulator. It just shows the emulator home screen. It just stops there.
Why is it getting here and not going any further?
UPDATE:
Now after trying to start the emulation again a second time, it gives the following error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
I have the same issue. I have resolved by building the app with cordova. then get myapp.app and run it over the emulator. you can follow the below steps:
run iOS simulator
install Xcode
Open emulator
build the app after adding platform iOS
run the app with the emulator
install ios sims
npm install -g ios-sim#next
List available simulators
xcrun simctl list
https://www.anexinet.com/blog/install-app-ios-simulator/
xcrun simctl install XXXXXXX-YYYYYY-XXXX-ZZZZ-XXXXXXXXX ~/path_to_app/myapp.app
More info
https://github.com/aymansalama/cordova-build-macos

React native cant build .ipa file

When I run :
react-native run-ios
everything works as expected, react native app runs everything as it should (had some troubles, adding react-native camera but editing info.plist / following the manual instructions, managed to get it to work)
Currently my goal is to get the .ipa file into an iPhone and try it out, but, following How to build .ipa application for react-native-ios? accepted answer, results in the app getting stuck on the itunes instalation (it says its installing but does nothing)
Other solution is to build .ipa from xcode, so I openned the ios project in xcode, but whenever I try to run it (even run it to emulator) it returns
"linker command failed with exit code 1"
in the "***Tests" app...
In summary : Can build app to emulator using react-native run-ios, can't get .ipa to install currectly on physical device

Resources