Xcode 7 beta -构建错误(xcassets)

时间:2022-12-11 20:54:22

I was just install Xcode 7 beta and converted my Swift project with Swift 2 guidelines.

我刚刚安装了Xcode 7测试版,并将我的Swift项目转换为Swift 2指南。

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的“Open developer tools”菜单中启动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...

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

3 个解决方案

#1


8  

Navigate to ~/Library/Developer/CoreSimulator/Profiles/Runtimes, then remove the runtime - the runtime is old. After, reboot Xcode7, and launch the Simulator...

导航到~/Library/Developer/CoreSimulator/Profiles/Runtimes,然后删除运行时——运行时是旧的。之后,重新启动Xcode7,并启动模拟器……

Further explanation from @seancook:

从@seancook进一步解释:

I experienced this, too, on El Capitan. NIBs wouldn't load, no Sims present, and unable to launch Simulators through the Xcode/Open Developer Tool/Simulator menu. After fighting it for a few hours I've finally got it working.

我在El Capitan也有过这样的经历。NIBs不会加载,没有Sims,也无法通过Xcode/Open Developer工具/模拟器菜单启动模拟器。经过几个小时的斗争,我终于使它奏效了。

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. I went to the path it described "/Library/Developer/CoreSimulator/Profiles/Runtimes" and removed the runtimes that I had there. They were old runtimes, so I assume that some check in Xcode now applies that didn't previously. Who knows?

这就是我的工作原理(YMMV):我注意到控制台里有一条消息。app沿着模拟器运行时的线没有代码签名。我走到它所描述的“/Library/Developer/CoreSimulator/Profiles/Runtimes”的路径,并删除了我在那里的运行时间。它们是旧的运行时,所以我假设现在在Xcode中进行一些检查。谁知道呢?

After doing this, I could finally launch the Simulator via the Xcode/Open Developer Tool menu. Unfortunately, the Simulator still wasn't being shown as a run target in my workspace, so I kept spelunking...

这样做之后,我终于可以通过Xcode/Open Developer Tool菜单启动模拟器了。不幸的是,模拟器仍然没有在我的工作空间中显示为一个运行目标,所以我一直在使用spelunking…

I then went into the Simulator's Hardware/Devices/Manage Devices menu and added a new iOS9 device. It didn't seem to do anything, so I quit out of Xcode and Simulator.app. I then re-started Simulator.app (via Xcode/ODT/Simulator) and lo and behold the expected iOS9 simulators were displayed. I closed and re-opened Xcode, changed the target OS for my project, and the Sims were finally displayed as run targets.

然后我进入模拟器的硬件/设备/管理设备菜单,添加了一个新的iOS9设备。它似乎什么也没做,所以我退出了Xcode和Simulator.app。然后我重新模拟器。应用程序(通过Xcode/ODT/模拟器)和lo并查看预期的iOS9模拟器。我关闭并重新打开了Xcode,为我的项目更改了目标OS, Sims最终显示为运行目标。

#2


5  

I was using an older xCode ( I have 8.3.1 installed by appstore and I was using 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 (appstore安装了8.3.1,使用的是8.2.1)。对于我来说,解决方案是Xcode/Preferences>位置和设置命令行工具:Xcode 8.2.1 (8C1002)(它以前是在新的Xcode中)

#3


2  

I just cleared the derived data and it works fine now.

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

#1


8  

Navigate to ~/Library/Developer/CoreSimulator/Profiles/Runtimes, then remove the runtime - the runtime is old. After, reboot Xcode7, and launch the Simulator...

导航到~/Library/Developer/CoreSimulator/Profiles/Runtimes,然后删除运行时——运行时是旧的。之后,重新启动Xcode7,并启动模拟器……

Further explanation from @seancook:

从@seancook进一步解释:

I experienced this, too, on El Capitan. NIBs wouldn't load, no Sims present, and unable to launch Simulators through the Xcode/Open Developer Tool/Simulator menu. After fighting it for a few hours I've finally got it working.

我在El Capitan也有过这样的经历。NIBs不会加载,没有Sims,也无法通过Xcode/Open Developer工具/模拟器菜单启动模拟器。经过几个小时的斗争,我终于使它奏效了。

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. I went to the path it described "/Library/Developer/CoreSimulator/Profiles/Runtimes" and removed the runtimes that I had there. They were old runtimes, so I assume that some check in Xcode now applies that didn't previously. Who knows?

这就是我的工作原理(YMMV):我注意到控制台里有一条消息。app沿着模拟器运行时的线没有代码签名。我走到它所描述的“/Library/Developer/CoreSimulator/Profiles/Runtimes”的路径,并删除了我在那里的运行时间。它们是旧的运行时,所以我假设现在在Xcode中进行一些检查。谁知道呢?

After doing this, I could finally launch the Simulator via the Xcode/Open Developer Tool menu. Unfortunately, the Simulator still wasn't being shown as a run target in my workspace, so I kept spelunking...

这样做之后,我终于可以通过Xcode/Open Developer Tool菜单启动模拟器了。不幸的是,模拟器仍然没有在我的工作空间中显示为一个运行目标,所以我一直在使用spelunking…

I then went into the Simulator's Hardware/Devices/Manage Devices menu and added a new iOS9 device. It didn't seem to do anything, so I quit out of Xcode and Simulator.app. I then re-started Simulator.app (via Xcode/ODT/Simulator) and lo and behold the expected iOS9 simulators were displayed. I closed and re-opened Xcode, changed the target OS for my project, and the Sims were finally displayed as run targets.

然后我进入模拟器的硬件/设备/管理设备菜单,添加了一个新的iOS9设备。它似乎什么也没做,所以我退出了Xcode和Simulator.app。然后我重新模拟器。应用程序(通过Xcode/ODT/模拟器)和lo并查看预期的iOS9模拟器。我关闭并重新打开了Xcode,为我的项目更改了目标OS, Sims最终显示为运行目标。

#2


5  

I was using an older xCode ( I have 8.3.1 installed by appstore and I was using 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 (appstore安装了8.3.1,使用的是8.2.1)。对于我来说,解决方案是Xcode/Preferences>位置和设置命令行工具:Xcode 8.2.1 (8C1002)(它以前是在新的Xcode中)

#3


2  

I just cleared the derived data and it works fine now.

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