找不到 iPhone 6(或任何其他)模拟器 React-Native,没有任何帮助吗?

Could not find iPhone 6(or any other) simulator React-Native, nothing helps?

不能 运行 我的项目与 iOS 模拟器

问题,

Could not find iPhone 6(or X or any other) simulator

XCODE: 10.2
    react-native: 0.52
    react: ^16.0.0-alpha.12

这是我来自 nodemodules/react-native/local-cli/runIOS:

findMatchingSimulator.js

/** * 版权所有 (c) 2015 年至今,Facebook, Inc. * 版权所有。 * * 此源代码是根据 BSD 风格的许可证获得许可的 * 此源代码树的根目录中的 LICENSE 文件。额外补助金 *专利权可以在同一目录下的PATENTS文件中找到。* */ 'use strict';

/** * 接受解析后的模拟器列表和所需的名称,并且 return 是一个具有匹配模拟器的对象。 * * 如果 simulatorName 参数为空,我们将进入默认模式和 return 当前启动的模拟器,或者如果 * none 被启动,它将是列表中的第一个。 *

 * @param Object simulators a parsed list from `xcrun simctl list --json devices` command
 * @param String|null simulatorName the string with the name of desired simulator. If null, it will use the currently
 *        booted simulator, or if none are booted, the first in the list.
 * @returns {Object} {udid, name, version}
 */
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;

我尝试了不同的方法,但没有任何帮助。 可用设备列表将 iPhone 指定为“不可用”

更改此行:

if (version.indexOf('iOS') !== 0) {

对此:

if (version.indexOf('com.apple.CoreSimulator.SimRuntime.iOS') !== 0) {

最近对 xcode 进行了更改,模拟器名称现在有前缀。这为我解决了。