I got this error when i ran: react-native run-ios
Could not find iPhone 6 simulator
Error: Could not find iPhone 6 simulator
at resolve (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
at new Promise (<anonymous>)
at runOnSimulator (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
at Object.runIOS [as func] (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
at Promise.resolve.then (/Users/xman/Desktop/TEST_COM/APP/orderapp/node_modules/react-native/local-cli/cliEntry.js:117:22)
We are automatically closing this issue because it does not appear to follow any of the provided issue templates.
Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.
If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.
same issue here
same issue here. Please help.
Info:
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 1.26 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.11.0 - /usr/local/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 23.0.1, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.1
API Levels: 21, 22, 23, 25, 26, 27, 28
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.2 => 0.57.2
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
react-native-scripts: 1.14.0
It works from XCode but command line it is not working.
This error is occurring because the response of "xcrun simctl list --json devices" got changed. "availability" is changed by "isAvailable"
Workaround :
Open file findMatchingSimulator.js --> Replace simulator.availability !== '(available)' with simulator.isAvailable !== 'YES'
This error is occurring because the response of "xcrun simctl list --json devices" got changed. "availability" is changed by "isAvailable"
Workaround :
Open file findMatchingSimulator.js --> Replace simulator.availability !== '(available)' with simulator.isAvailable !== 'YES'Thank you very much. I was breaking my head from so many days.
Curious to know, who is at fault here? XCode? or React Native?
I would say XCode. Accordingly ReactNative code should be updated. I would like to add pull request for that but this issue is already been closed by bot. Any idea how could I do that?
Same issue here. Editing :
./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
This:
function findMatchingSimulator(simulators, simulatorName) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
var match;
for (let version in devices) {
console.log(" version in devices ");
console.log(version);
// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
if (!version.startsWith('iOS') && !version.startsWith('tvOS')) {
console.log(" expecting code to find iOS simulator version, but it fails. ");
continue;
}
shows me:
com.apple.CoreSimulator.SimRuntime.tvOS-12-1
expecting code to find iOS simulator version, but it fails.
version in devices
com.apple.CoreSimulator.SimRuntime.iOS-12-1
expecting code to find iOS simulator version, but it fails.
version in devices
com.apple.CoreSimulator.SimRuntime.tvOS-12-2
expecting code to find iOS simulator version, but it fails.
version in devices
com.apple.CoreSimulator.SimRuntime.watchOS-5-2
expecting code to find iOS simulator version, but it fails.
version in devices
com.apple.CoreSimulator.SimRuntime.watchOS-5-1
expecting code to find iOS simulator version, but it fails.
version in devices
com.apple.CoreSimulator.SimRuntime.iOS-12-2
expecting code to find iOS simulator version, but it fails.
So I guess the structure of version
has changed, and this is breaking the code?
I'll point out that doing string matching, based on strings being passed in from other tools and even other eco-systems, is bound to be fragile. Not that I can think of an alternative.
In case anybody else stumbles here, my solution was different.
What fixed it for me was manually updating our node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
from
if (!version.startsWith('iOS') && !version.startsWith('tvOS'))
to
if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS'))
If you console.log(version)
, each is now prefixed with com.apple.CoreSimulator.SimRuntime.
Also looks like
simulator.isAvailable !== 'YES'
should now be
if (simulator.isAvailable !== true)
And for anybody now getting: Nullability Issue Pointer is missing a nullability type specifier
I've created a gist that fixes RCTLinkingManager.h
here: https://gist.github.com/leotm/05e34468f25c29623a731692738e140e
And finally get a successful build with XCode 10.2 (10E125) \o/
After upgrading to Xcode 10.2 this needs to be done if you are still using RN 0.53
open
node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
replace
if (version.indexOf('iOS') !== 0)
with
if (version.indexOf('com.apple.CoreSimulator.SimRuntime.iOS') !== 0)
Thank @Kamahl19 , it work for me!
@leotm - do you have any idea when or how this will be fixed in react-native? It seems that it will now affect everyone. I'm currently on 0.57.8, and experiencing this issue, but looks like even if you are on the latest version you still get this.
Updating the file in node_modules is not a good solution these are temporary files.
Am I the only one who does not have node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js ? There is only one thing inside the local-cli folder, which is the file cli.js - any ideas??
In addition to what @leotm said,
I've found that some simulator names have changed in Xcode 10.2 (iOS 12.2 SDK),
iPhone XS
becomes iPhone Xs
iPhone XS Max
becomes iPhone Xs Max
iPhone XR
becomes iPhone XÊ€
So instead of running,
react-native run-ios --simulator "iPhone XS Max"
You should run
react-native run-ios --simulator "iPhone Xs Max"
@leotm - do you have any idea when or how this will be fixed in react-native? It seems that it will now affect everyone. I'm currently on 0.57.8, and experiencing this issue, but looks like even if you are on the latest version you still get this.
Updating the file in node_modules is not a good solution these are temporary files.
Confirmed working with "react-native": "0.59.2"
and an iPhone X simulator running iOS 12.1 (app doesn't appear to start with iOS 12.2).
Be prepared to update dependencies âš”
Am I the only one who does not have node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js ? There is only one thing inside the local-cli folder, which is the file cli.js - any ideas??
Tried node_modules/@react-native-community/cli/build/commands/runIOS/findMatchingSimulator.js
?
it works for me:
if (!version.startsWith('iOS') && !version.startsWith('tvOS'))
to
if (
!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS-12-2') &&
!version.startsWith('tvOS')
)
./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
@patrickgodinho your solution worked perfectly for me! Thanks 💯
@patrickgodinho can confirm, pretty solid and works fine.
@patrickgodinho I can not this
if (!version.startsWith('iOS') && !version.startsWith('tvOS'))
part of code in
./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
instead I see
function findMatchingSimulator(simulators, simulatorName) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
var match;
for (let version in devices) {
// Making sure the version of the simulator is an iOS (Removes Apple Watch, etc)
if (version.indexOf('iOS') !== 0) {
continue;
}
for (let i in devices[version]) {
let simulator = devices[version][i];
// Skipping non-available simulator
if (simulator.availability !== '(available)') {
continue;
}
// If there is a booted simulator, we'll use that as instruments will not boot a second simulator
if (simulator.state === 'Booted') {
if (simulatorName !== null) {
console.warn("We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time.");
}
return {
udid: simulator.udid,
name: simulator.name,
version
};
}
if (simulator.name === simulatorName && !match) {
match = {
udid: simulator.udid,
name: simulator.name,
version
};
}
// Keeps track of the first available simulator for use if we can't find one above.
if (simulatorName === null && !match) {
match = {
udid: simulator.udid,
name: simulator.name,
version
};
}
}
}
if (match) {
return match;
}
return null;
}
module.exports = findMatchingSimulator;
Can you please help ? @Monte9 @ahmadalfy
i am just updated react-native latest version "0.58.6"
Really shouldn't be updating the code contained in node_modules if you can avoid it. Anyone who doesn't have that fix will run into the same issue and any updates to the packages you edit will reverse the "fix".
@samparmenter I can imagine the issues this hack will cause, what alternatives do you suggest?
it works for me:
if (!version.startsWith('iOS') && !version.startsWith('tvOS'))
to
if ( !version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS-12-2') && !version.startsWith('tvOS') )
./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
I changed the if condition to
if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS'))
(instead of the code above) and it's working for me!
To make patrickgodinho's fix more automatic, add
"scripts": {
"postinstall": "sed -i '' \"s/version.startsWith('iOS')/version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS')/g\" ./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js"
}
to your package.json.
When you or a coworker runs npm install
, the bug will go away.
Thanks @mcjohnalds ! Nice snippet!
Run it right away with npm run postinstall
, or by triggering a new npm install
on your project.
If you start another simulator with XCode 12.2.1 to test the app on iPad you must change the version:
before
react-native run-ios --simulator='iPad Pro (11-inch) (12.2)'
now
react-native run-ios --simulator='iPad Pro (11-inch) (12-2)'
i upgraded my react-native version to latest (last week) - and this seems to have been fixed in newer versions.
Trying to run the script proposed by @mcjohnalds on this version, yields an error that its unable to locate the text it wants to replace.
"react": "16.8.3",
"react-native": "^0.59.4",
In case anybody else stumbles here, my solution was different.
What fixed it for me was manually updating our
node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
fromif (!version.startsWith('iOS') && !version.startsWith('tvOS'))
to
if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS'))
If you
console.log(version)
, each is now prefixed withcom.apple.CoreSimulator.SimRuntime.
Also looks like
simulator.isAvailable !== 'YES'
should now be
if (simulator.isAvailable !== true)
And for anybody now getting:
Nullability Issue Pointer is missing a nullability type specifier
I've created a gist that fixes
RCTLinkingManager.h
here: https://gist.github.com/leotm/05e34468f25c29623a731692738e140eAnd finally get a successful build with XCode 10.2 (10E125) \o/
Thanks. It worked for me.
To make patrickgodinho's fix more automatic, add
"scripts": { "postinstall": "sed -i '' \"s/version.startsWith('iOS')/version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS')/g\" ./node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js" }
to your package.json.
When you or a coworker runs
npm install
, the bug will go away.
for anyone who looking for the solution about old version React Native project that runs failed on the newest XCode, please just using this as a workaround.
thank you for just saving my day :p
This error is occurring because the response of "xcrun simctl list --json devices" got changed. "availability" is changed by "isAvailable"
Workaround :
Open file findMatchingSimulator.js --> Replace simulator.availability !== '(available)' with simulator.isAvailable !== 'YES'
It dose not work for me. still get 'could not find iPhone 6 simulator' here
@369855707 instead of 'YES' you have to use true
if (simulator.isAvailable !== true) {
I tried everything you guys suggested but nothing works. I'm using Xcode 11 and React Native 0.60.5
"react": "16.8.6",
"react-native": "^0.59.4",
by this i worked
For me this was related to the xcode upgrade, with the default iPhone x simulator no longer available. I suggest specifiying iphone 11 instead
I tried everything you guys suggested but nothing works. I'm using Xcode 11 and React Native 0.60.5
seems like XCode 11 has change something related to simulator keys, so these old fix method were no longer useful. for now if you still can't get it works, you can still start app within simulator by using XCode's run button.
Most helpful comment
In case anybody else stumbles here, my solution was different.
What fixed it for me was manually updating our
node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
fromto
If you
console.log(version)
, each is now prefixed withcom.apple.CoreSimulator.SimRuntime.
Also looks like
should now be
And for anybody now getting:
Nullability Issue Pointer is missing a nullability type specifier
I've created a gist that fixes
RCTLinkingManager.h
here: https://gist.github.com/leotm/05e34468f25c29623a731692738e140eAnd finally get a successful build with XCode 10.2 (10E125) \o/