简体   繁体   English

Xcode 7 beta - 构建错误(xcassets)

[英]Xcode 7 beta - build error (xcassets)

I was just install Xcode 7 beta and converted my Swift project with Swift 2 guidelines. 我只是安装Xcode 7 beta并使用Swift 2指南转换了我的Swift项目。

Build is OK but xcassets: I reached this error in logs: 构建是可以的但是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))

UPD: Now when I try to launch iOS Simulator from "Open developer tools" menu from dock I reach this error: UPD:现在,当我尝试从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: When trying launch simulator from terminal got warning: 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

I think this is a main issue... 我认为这是一个主要问题......

Navigate to ~/Library/Developer/CoreSimulator/Profiles/Runtimes , then remove the runtime - the runtime is old. 导航到~/Library/Developer/CoreSimulator/Profiles/Runtimes ,然后删除运行时 - 运行时很旧。 After, reboot Xcode7, and launch the Simulator... 之后,重启Xcode7,启动模拟器......

Further explanation from @seancook : 来自@seancook的进一步解释:

I experienced this, too, on El Capitan. 我也在El Capitan身上体验过这一点。 NIBs wouldn't load, no Sims present, and unable to launch Simulators through the Xcode/Open Developer Tool/Simulator menu. NIB不会加载,不会出现模拟人生,也无法通过Xcode / Open Developer Tool / Simulator菜单启动模拟器。 After fighting it for a few hours I've finally got it working. 经过几个小时的战斗,我终于开始工作了。

Here's what worked for me (YMMV): I noticed a message in Console.app along the lines of the Simulator runtime not being code signed. 这对我有用(YMMV):我注意到Console.app中的一条消息沿着Simulator运行时没有进行代码签名。 I went to the path it described "/Library/Developer/CoreSimulator/Profiles/Runtimes" and removed the runtimes that I had there. 我去了它描述的路径“/ Library / Developer / CoreSimulator / Profiles / Runtimes”并删除了我在那里的运行时。 They were old runtimes, so I assume that some check in Xcode now applies that didn't previously. 它们是旧的运行时,所以我假设现在应用Xcode中的一些检查以前没有。 Who knows? 谁知道?

After doing this, I could finally launch the Simulator via the Xcode/Open Developer Tool menu. 完成此操作后,我终于可以通过Xcode / Open Developer Tool菜单启动模拟器。 Unfortunately, the Simulator still wasn't being shown as a run target in my workspace, so I kept spelunking... 不幸的是,模拟器仍然没有在我的工作区中显示为运行目标,所以我一直在探索......

I then went into the Simulator's Hardware/Devices/Manage Devices menu and added a new iOS9 device. 然后我进入模拟器的硬件/设备/管理设备菜单并添加了一个新的iOS9设备。 It didn't seem to do anything, so I quit out of Xcode and Simulator.app. 它似乎没有做任何事情,所以我退出了Xcode和Simulator.app。 I then re-started Simulator.app (via Xcode/ODT/Simulator) and lo and behold the expected iOS9 simulators were displayed. 然后我重新启动了Simulator.app(通过Xcode / ODT / Simulator)并且看到了预期的iOS9模拟器。 I closed and re-opened Xcode, changed the target OS for my project, and the Sims were finally displayed as run targets. 我关闭并重新打开Xcode,为我的项目更改了目标操作系统,最终将Sims显示为运行目标。

I was using an older xCode ( I have 8.3.1 installed by appstore and I was using 8.2.1). 我使用的是较旧的xCode(appstore安装了8.3.1,我使用的是8.2.1)。 For me, the solution was Xcode/Preferences>Locations and setting Command Line Tools: Xcode 8.2.1 (8C1002) (it was on the newer Xcode before) 对我来说,解决方案是Xcode / Preferences> Locations和设置命令行工具:Xcode 8.2.1(8C1002)(它之前是更新的Xcode)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM