我尝试从适用于 iOS 的新 Metal API 中查看新样本。当我下载代码并在 XCode 6 Beta 中打开它时,我收到以下错误消息:
QuartzCore/CAMetalLayer.h file not found
我需要添加一些其他文件还是我错过了其他东西?Metal API 应该在 OSX 10.9.3 中可用。
是否需要升级到 Yosemite 10.10 Beta 才能运行这些示例?
此错误背后的原因是它仅适用于具有 A7+ 芯片的设备,模拟器不适用于此。
尝试将设备目标切换到您的 iOS 设备 (a7+),Metal 在 iOS 模拟器中不可用。
CAMetalLayer
在 macOS 10.15 上运行时,现在在 iOS 13 / tvOS 13 模拟器中受支持。(它始终存在,但如果您在 macOS Mojave 上运行,它将无法正常工作)。
我认为这是测试版中 iOS 模拟器的疏忽(直到当前的 beta 2):/Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/系统/库/Frameworks/QuartzCore.framework/Headers/
它缺少 CAMetalLayer.h
但是,如果您将测试版安装到您的 iOS 设备上,它就在那里:/Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks /QuartzCore.framework/Headers/CAMetalLayer.h
请选择 iPhone 设备而不是模拟器。