react-native run-ios fails - Could not find simulator - ios

I am using
react-native-cli: 2.0.1
react-native: 0.55.3
Xcode : 10.2.1
I am trying to get a certain react-native project to build and run for the first time from my system using react-native run-ios.
I get :
Found Xcode workspace App.xcworkspace
Could not find iPhone 6 simulator
I looked for the different answers here but they didn't help me solve my problem (I changed the condition in node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js)
What's the meaning of this error ?
How to get the project to build and run ?
Thanks
Yaron

This happened to me after updating to the latest Xcode.
I went to the Download simulators, chose the newest one, and after it got downloaded and installed, I got back the devices you see in the screenshot

Related

No Such Module Flutter

I've run the flutter app from XCode Using XCode version 13.2.1 (latest in January 2022)
XCode showing error like mentioned in image :
It is claimed by the Flutter team to be a bug with the visual component of XCode... as evidenced by the fact that the project will still build and run from XCode.
There are many reported ways to get rid of it temporarily, such as doing Product\build , Product\Clean Build Folder, or running the project on IOS from within Android Studio...
But these are only temporary and the problem will reappear.
https://github.com/flutter/flutter/issues/92337
How to get rid of this critical issue in XCode, thanks in advance.

dyld: Library not loaded: /usr/lib/swift/libswiftWebKit.dylib

I'm getting this error when I run my app through iphone 6s ios version 13.1.2 but it is workin with ios version 14 and up. I tried deleting Pods, brew update, brew upgrade, brew cleanup and update my xcode to latest version but I still get this error. How to fix this error? thank you so much!
I had the same error and fixed it by going into my app in Xcode under the Project Navigator, then opening Frameworks, and deleting libSwiftWebKit.tbd. I had recently updated the deployment target to IOS 12 as well as updated the Podfile, which I think had something to do with it. I think there was a bug in an earlier version of Xcode or my Podfile settings, whereby I had to include libSwiftWebKit.tbd manually, but after recent updates, that was fixed such that it doesn't need to be included manually anymore.
I experienced the same issue and was exhausted with that because I tried different other suggestions but all were in vain. In the end, Deleting the Build folder from Xcode brought me luck.
So my suggestion will be, first of all, to try to
Delete the Build folder (Xcode > Products > Clean Build Folder) or (Shift+Command+K)
If it doesn't work then try other options.

Unable to build react native project after updating to xcode 11.0

I have a react native project running on react native version 0.59.8 , and xcode version 10.3. Somehow my xcode got updated to version 11.0 and after that i am unable to build the project using react-native run-ios command.
I have tried cleaning up the build and building again. But that doesn't help.
I am getting the following error:
CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
error Could not find iPhone X simulator.
How to fix this issue?
Not sure about the first error, but I have same problem for second error error Could not find iPhone X simulatorafter upgrade to XCode 11
Basically I changed the line 53 in the react native project /node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js, from simulator.isAvailable !== 'YES' to simulator.isAvailable !== true.
The root cause is new XCode 11 changed the simulator metadata format, and react native findMatchingSimulator method is strongly coupled to the previous format.
I was able to fix the "Could not find iPhone X simulator" error.
These are the steps to fix the above error:
Run the command find . -iname findMatchingSimulator.js to locate findMatchingSimulator.js file.
In this file, Change the code from
if (simulator.availability !== '(available)' && simulator.isAvailable !== 'YES') {
continue;
}
to
if (simulator.availability !== '(available)' && simulator.isAvailable !== true) {
continue;
}
By doing this simulator error is resolved. But Still the other error
CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
exists, which makes the build to fail. If I install xcode 10.3 and run the command react-native run-ios, it still works.
Hope the issue is clear. Any fixes for this issue which occurs in xcode 11?
Two things:
With Xcode 11, make sure you're using react-native-community/cli version 1.9.8 minimum, as it integrates the fix for Xcode 11 simulators new metadata format:
https://github.com/react-native-community/cli/releases/tag/v1.9.8
Also, the iPhone X simulator is no longer available at least on my end. You can use an iPhone 11 instead :
react-native run-ios --simulator='iPhone 11'
In my case:
react: 16.8.3
react-native: 0.59.9
Xcode: 11.0
Add iPhone X simulator: Open Xcode => Window => Devices and Simulators => Simulators => Press Plus button at the bottom
Install latest version of cocoapods: sudo gem install cocoapods
Re-Install cocoapods in project: Open project folder => ios => delete Podfile.lock, Pods folder, build folder => cd ios && pod install
react-native run-ios Done!
After upgrading my XCode to version 11, in XCode simulators list it only shows ios 13 simulators as available, so we need to add previous version simulators, to do so, in XCode go to preferences -> Components -> and download and install a previous version ios simulator (ios 11.0 in my case), after doing so it must show other simulators in available simulator list. Clear all cache and re-run the react-native run-ios command and it should work now.
Try run specifying simulator version.
react-native run-ios --simulator="iPhone 11 Pro Max"
I upgraded "react-native" to "^0.61.1" and it worked for me
I was having this same issue, and even went back to xCode 10.3....and still had the same issue. Then I came across this https://github.com/react-native-community/cli/pull/414 . Sounded to me like maybe they had fixed the issue and that I was running with an old version of the CLI. Proceeded to delete the entry in my lock file and run npm install. Working now. CLI is up to 1.11.2 https://github.com/react-native-community/cli
Run can run xcrun simctl list devices in a terminal to make sure you have the iPhone X simulator installed. If you can't see it in the list you need to add it to Xcode through Window -> Devices and Simulators -> Simulators (click the + in the bottom left)

react-native build failed: Xcode 7.2.1, react-native cli v : 2.0.1 (MacOSX 10.10.5)

I'm new to react native. Initialised a new project by running react-native init project-name and then running it on Xcode but the build was failed....again and again.
By looking at solutions posted by other users, I commented out this line of code in file RCTPlatform.m :
// case UIUserInterfaceIdiomCarPlay:
// return #"carplay";
That's one issue solved, but then when I tried to build the project it gave me another error:
Please can someone help me out. I have no idea what went wrong. I haven't even started any coding work on the project.
According to the React Native Getting Started documentation, "make sure it (XCode) is version 8 or higher." In order to upgrade your XCode version to greater than 8.0, you will first need to upgrade your MacOSX to Sierra. You can do this in the App Store. Good luck!

Unable to open liblaunch_sim.dylib

Today I have updated xcode. when i tried to run project on simulator(ios version < 9.0) I got this error.
"Unable to open liblaunch_sim.dylib. Try reinstalling Xcode or the simulator runtime.
It ran perfectly on ios9.0 simulator.
here is screen shot. please help me.
This will also occur when you don't have the simulator actually installed within XCode. I recently upgraded to XCode 7.1 and didn't install all simulators and received this same error.
Go to Preferences -> Downloads
Verify you have a checkmark next to the desired Simulator you are trying to run within XCode.
If no checkmark, then install the simulator of choice. 8.1, 8.2, 8.3, 8.4
I don't think that there is an "officially supported" way to solve this yet, but have a look at this answer (which originates from this more detailed troubleshoot) for a potential fix.
[Edit] In you case, try running those:
sudo cp "/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.‌​dylib"{,.bak}
sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/D‌​eveloper/SDKs/iPhoneSimulator.sdk/usr/lib/system/host/liblaunch_sim.dylib" "/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.‌​dylib"
First, find the target file:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/host/liblaunch_sim.dylib
You need make backup liblaunch_sim.dylib
Second, copied to destination (Remember to backup)
/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib
And If need it to: iOS 8.1.simruntime iOS 8.2.simruntime iOS 8.3.simruntime All done.
Hope it helps.
I faced similar problem this problem occurs when we have multiple versions of Xcode Installed ... So i force quit all the xcode and simulator and then open the xcode version you want to open.

Resources