Xcode设备不可用,运行时配置文件未找到。

24
在下面的环境中:
Xcode 8.3.2
react-native-cli 2.0.1
react-native: 0.44.0
macOS Sierra 10.12.5

我刚刚更新了Xcode和macOS,以便运行React Native并继续练习,但每次尝试运行:

react-native run-ios

我收到以下错误信息:
Scanning 555 folders for symlinks in /Users/juangarcia/projects/react-tests/CountDown/node_modules (6ms)
Found Xcode project CountDown.xcodeproj

Could not find iPhone 6 simulator

我尝试查看可用设备列表,但得到以下信息:

~/projects/react-tests/CountDownSample » xcrun simctl list devices
== Devices ==
-- iOS 10.3 --
-- tvOS 10.2 --
    Apple TV 1080p (323FA90C-0366-4B5B-AEEE-D0477C61762A) (Shutdown)
-- watchOS 3.2 --
    Apple Watch - 38mm (F42C0C0D-325B-41DD-948D-E44B0A08B951) (Shutdown)
    Apple Watch - 42mm (75D8BAF1-27CB-47EE-9EE3-D400B962F8BC) (Shutdown)
    Apple Watch Series 2 - 38mm (64D01BD4-5C37-4885-A73A-52479D9CCF4F) (Shutdown)
    Apple Watch Series 2 - 42mm (8471C9FD-BCF3-4DDC-B386-F17E128C5EB1) (Shutdown)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-9-3 --
    iPhone 4s (1FF2D0D3-F136-43A7-8148-7B1849A7B1E3) (Shutdown) (unavailable, runtime profile not found)
    iPhone 5 (859D4D90-F1B5-4DE8-B976-6984F85CAFE3) (Shutdown) (unavailable, runtime profile not found)
    iPhone 5s (5B2AD8CD-9B3F-413C-BF16-FA96F807BB2B) (Shutdown) (unavailable, runtime profile not found)
    iPhone 6 (2573D214-4371-47A8-BFF6-3341862954E0) (Shutdown) (unavailable, runtime profile not found)
    iPhone 6 Plus (8916CD9B-4D8B-463F-8583-75A2CE4F61FD) (Shutdown) (unavailable, runtime profile not found)
    iPhone 6s (41093980-7912-4F98-9D06-981A533FAAFE) (Shutdown) (unavailable, runtime profile not found)
    iPhone 6s Plus (6A85D2AE-D867-4341-979C-FEE8308DE93E) (Shutdown) (unavailable, runtime profile not found)
    iPad 2 (BFBB5477-B6D9-48C3-B529-516D2D9105A7) (Shutdown) (unavailable, runtime profile not found)
    iPad Retina (C49B5920-F4FF-4D7F-AA74-7AE2367FF09D) (Shutdown) (unavailable, runtime profile not found)
    iPad Air (4101FC8E-D8B9-4496-AD2B-1484661C15DE) (Shutdown) (unavailable, runtime profile not found)
    iPad Air 2 (9952B05C-829F-428F-AC76-EB1F8FB55D72) (Shutdown) (unavailable, runtime profile not found)
    iPad Pro (735082E2-4470-4D9A-BAA1-BEDA8426B725) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.tvOS-9-2 --
    Apple TV 1080p (AD48DE24-6295-4EFC-9787-A9B5D8118503) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.watchOS-2-2 --
    Apple Watch - 38mm (C3F2A7C3-3967-4159-9B79-13CBA63E399E) (Shutdown) (unavailable, runtime profile not found)
    Apple Watch - 42mm (656005A9-7555-4872-A7FB-FB6BCB65139C) (Shutdown) (unavailable, runtime profile not found)

React默认使用Iphone 6,但目前不可用。

如何使它重新可用?为什么会出现这种情况?


2
请问您能否检查一下系统中是否有iPhone6模拟器?我遇到了同样的问题。但是如果我重新启动系统,它就可以正常工作。 - Nirmalsinh Rathod
1
它们在Xcode中显示吗?在运行按钮右侧。 - G0dsquad
6个回答

15
我在xCode 9和10.2中遇到了这个问题。 g em 对于其他遇到同样问题的人,以下是帮助我的方法:
  1. 关闭xCode
  2. 重新启动您的笔记本电脑(我知道这很糟糕)
  3. 重新打开xCode并再次运行构建

我在升级到Xcode 12后遇到了这个问题,退出Xcode和模拟器后问题得到了解决。 - Norman

15

简述:

使用xcrun simctl upgrade将不可用的模拟器升级到最新版本(或所需版本)的iOS运行时。

详情:

我在这种情况下,可能是在安装了Xcode 10和Xcode 11(以及当前活动的Xcode 10)后执行了xcrun simctl delete unavailable命令。

通过执行xcrun simctl list runtimes,我发现iOS 13.1运行时已列出:

iOS 11.4 (11.4 - 15F79) - com.apple.CoreSimulator.SimRuntime.iOS-11-4
iOS 13.1 (13.1 - 17A844) - com.apple.CoreSimulator.SimRuntime.iOS-13-1
tvOS 13.0 (13.0 - 17J585) - com.apple.CoreSimulator.SimRuntime.tvOS-13-0
watchOS 6.0 (6.0 - 17R575) - com.apple.CoreSimulator.SimRuntime.watchOS-6-0

但是当我执行xcrun simctl list命令时,发现有几个模拟器是不可用的:

    iPhone 8 Plus (B08025C1-B7A2-40C0-B6D5-517EC8BB3C45) (Shutdown) (unavailable, runtime profile not found)
    iPhone Xs (0A1C1EAA-8E18-4508-9E14-C376D944984B) (Shutdown) (unavailable, runtime profile not found)
    iPhone Xs Max (84C692F5-6CF3-449D-B166-0EA26B1FAC4B) (Shutdown) (unavailable, runtime profile not found)
    iPhone Xʀ (7581E116-5CFB-4A94-94A0-30B5B8871874) (Shutdown) (unavailable, runtime profile not found)

我的解决方案是将不可用的模拟器升级到所需的iOS运行时(在我的情况下是iOS 13.1):

xcrun simctl upgrade SIMULATOR_ID "com.apple.CoreSimulator.SimRuntime.iOS-13-1"

为了避免手动为所有模拟器执行此操作,我编写了这个小的ruby脚本,以一次性升级所有的iPhone模拟器:

#!/usr/bin/ruby

uuid_regex = /([0-9A-Z]{8}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{12})/
unavailable_iPhones = `xcrun simctl list | grep iPhone | grep "runtime profile not found"`.split("\n")
unavailable_iPhones.each do | row |
    uuid = row.match(uuid_regex).captures.first
    system("xcrun simctl upgrade #{uuid} \"com.apple.CoreSimulator.SimRuntime.iOS-13-1\"")
end

等等,你把所有模拟器的操作系统版本升级到了iOS 13.1? - duhaime
不,只有那些被列为“不可用”的。 - francybiga

8

安装SO和Xcode的时候,出乎意料的简单。但是由于某些原因,设备列表全部被删除了。在Xcode UI菜单中添加一个新的模拟器(例如iPhone 6)就足够了。我尝试过重启和返回,但不知道UI中有这个选项,因为我是XCode环境中的新手。感谢您的回答。

在XCode菜单中,选择Window --> Devices --> Add the new simulator...即可。


2
我进入了node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js文件,并做出如下替换:
将原来的代码: if (version.indexOf('iOS') !== 0 ) 替换为: if (!version.includes("iOS" )) 将原来的代码: if (simulator.availability !== '(available)') 替换为: if (simulator.isAvailable !== true) 替换后的代码能够更好地实现功能。

1

Xcode 12 beta 4中缺少iOS14模拟器选项的解决方法:

请查看有关simctl的精彩文章。

由于XC12-beta4没有通过以下方式提供下载/创建选项,因此我创建了一个iOS14模拟器:

xcrun simctl create <name> <device> <os>

例如:

xcrun simctl create iPhone-8Plus-14 com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus com.apple.CoreSimulator.SimRuntime.iOS-14-0


1
如果您打开了多个版本的Xcode,您可能需要重新启动或完全重新安装CoreSimulatorService,这是一个邪恶的、全局安装的后台服务,尽管它只与一个版本兼容,但它仍然在线并可用于许多版本的Xcode。
更多信息请参见:https://dev59.com/rlQK5IYBdhLWcg3wF8B6#72946533 此问题的其他症状包括:模拟器未显示在“窗口 > 设备和模拟器”列表中,以及以下内容:
- Command CompileAssetCatalog failed with a nonzero exit code - Encountered an error communicating with IBAgent-iOS. Failed to boot device iPhone Xs

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接