Xcode 7 beta - 构建错误(xcassets)

7

我刚刚安装了Xcode 7 beta,并按照Swift2的指导方针将我的Swift项目进行了转换。

构建是OK的,但是在xcassets中:我在日志中遇到了以下错误:

CompileAssetCatalog /Users/phoenix/Library/Developer/Xcode/DerivedData/{...}/Build/Products/Debug-iphoneos/{...}.app {...}/Images.xcassets
cd /Users/phoenix/Dev/Xcode/{...}
export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode-beta.app/Contents/Developer/usr/bin/actool --output-format human-readable-text\
    --notices --warnings --export-dependency-info /Users/phoenix/Library/Developer/Xcode/DerivedData/{...}/Build/Intermediates/{...}.build/Debug-iphoneos/{...}.build/assetcatalog_dependencies.txt
    --output-partial-info-plist /Users/phoenix/Library/Developer/Xcode/DerivedData/{...}/Build/Intermediates/{...}.build/Debug-iphoneos/{...}.build/assetcatalog_generated_info.plist\
    --app-icon AppIcon --launch-image LaunchImage --compress-pngs\
    --enable-on-demand-resources YES --target-device iphone --target-device ipad\
    --minimum-deployment-target 7.0 --platform iphoneos --compile\
    /Users/phoenix/Library/Developer/Xcode/DerivedData/{...}/Build/Products/Debug-iphoneos/{...}.app\
    /Users/phoenix/Dev/Xcode/{...}/Images.xcassets
/Users/phoenix/Dev/Xcode/{...}/Images.xcassets: error:
    Failed to find a suitable device for the type SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPad-2 with runtime SimRuntime :
    9.0 (13A4254u) - com.apple.CoreSimulator.SimRuntime.iOS-9-0
Failure Reason: Failed to create new simulator device that matches SimDeviceType :
    com.apple.CoreSimulator.SimDeviceType.iPad-2 for runtime SimRuntime :
    9.0 (13A4254u) - com.apple.CoreSimulator.SimRuntime.iOS-9-0 ((null))

更新: 现在当我尝试从“打开开发人员工具”菜单中的dock启动iOS模拟器时,会出现以下错误:

Dyld Error Message:
Library not loaded:
    @rpath/SimulatorKit.framework/Versions/A/SimulatorKit
Referenced from: /Applications/Xcode-beta.app/Contents/Developer/Applications/Simulator.app/Conte‌​nts/MacOS/Simulator
Reason: image not found

UPD2: 当尝试从终端启动模拟器时,会收到警告:
$ Applications/Simulator.app/Contents/MacOS/Simulator 
dyld: warning, LC_RPATH @loader_path/../../../../Library/PrivateFrameworks in /Applications/Xcode-beta.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator being ignored in restricted program because of @loader_path
dyld: Library not loaded: @rpath/SimulatorKit.framework/Versions/A/SimulatorKit
  Referenced from: /Applications/Xcode-beta.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
  Reason: image not found

我认为这是一个主要问题...


重新启动 Xcode、iOS 模拟器和 Mac(如有必要)? - LinusGeffarth
@LinusG.,Xcode已经重新启动了多次... iOS模拟器无法重新启动,因为它没有启动...好的,现在我将尝试重新启动Mac。 - PhoeniX
如果那不起作用,尝试重新安装Xcode。如果你仍然有.dmg文件,那就不应该是个问题。 - LinusGeffarth
@LinusG。所以,重新安装并没有帮助。我尝试在另一台Mac上安装Xcode beta,它可以直接使用模拟器和构建。所以我不明白其中的区别... - PhoeniX
这真的很奇怪。你在运行OS X beta吗? - LinusGeffarth
显示剩余6条评论
3个回答

8
导航到~/Library/Developer/CoreSimulator/Profiles/Runtimes,然后删除运行时 - 运行时已经过时。之后,重新启动Xcode7,并启动模拟器...。
来自@seancook的进一步解释:

我也在El Capitan上遇到了这个问题。NIB不会加载,没有Sims可用,并且无法通过Xcode/Open Developer Tool/Simulator菜单启动模拟器。经过几个小时的奋斗,我终于让它工作了。

以下是对我有用的内容(YMMV): 我注意到Console.app中有一条关于模拟器运行时未经代码签名的消息。我去了它所描述的路径“/Library/Developer/CoreSimulator/Profiles/Runtimes”,并删除了我在那里的运行时。它们是旧的运行时,因此我认为现在应用了以前不存在的Xcode检查。谁知道呢?

在做完这些之后,我终于可以通过Xcode/Open Developer Tool菜单启动模拟器了。不幸的是,模拟器仍然没有显示为我的工作区的运行目标,所以我继续探索...

然后我进入了模拟器的Hardware/Devices/Manage Devices菜单,并添加了一个新的iOS9设备。它似乎没有做任何事情,所以我退出了Xcode和Simulator.app。然后我重新启动了Simulator.app(通过Xcode/ODT/Simulator),惊讶地发现预期的iOS9模拟器被显示出来了。我关闭并重新打开了Xcode,改变了我的项目的目标操作系统,Sims最终被显示为运行目标。


这对我有用!我猜测在我的情况下,这个问题是由于在空间不足后尝试删除文件所引起的。 - hvaughan3
希望我能编辑之前的评论,但我想提一下,在Xcode中下载新的模拟器运行时后,我不得不完全重启我的电脑,才能使事情再次正常工作。 - hvaughan3

5

我曾使用较旧的xCode(我通过应用商店安装了8.3.1版本,而当时我使用的是8.2.1版本)。 对于我来说,解决方法是在Xcode/首选项>位置中设置命令行工具:Xcode 8.2.1 (8C1002)(此前它在更新的Xcode版本中)。


2

我刚刚清除了派生数据,现在它可以正常工作了。


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