ios – Xcode 7 beta – 构建错误(xcassets)

我只是安装 Xcode 7 beta并使用 Swift 2指南转换了我的 Swift项目.

构建是可以的,但是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:
现在,当我尝试从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

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

解决方法

导航到〜/ Library / Developer / CoreSimulator / Profiles / Runtimes,然后删除运行时 – 运行时很旧.之后,重启Xcode7,启动模拟器……

@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.

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?

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…

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.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...