GPUImage3 simulator error (`Error: MPS does not support the iOS simulator.')

GPUImage3 simulator error (`Error: MPS does not support the iOS simulator.')

enter image description here

在 iOS 13 上使用 GPUImage 3 框架,

我有这些错误:

Touch the screen of the simulator -> error. `Error: MPS does not support the iOS simulator.'

不能运行模拟器使用金属套件?

谢谢。

根据Developing Metal Apps that Run in Simulator

In Xcode 11, Simulator adds support for Metal development. You can write iOS and tvOS apps that use Metal and test them in the Simulator, gaining the benefits of hardware acceleration on the Mac during development of your app.

Supporting Simulator in a Metal App

我猜这次崩溃与 GPUImage3 框架有关,但是..我尝试 运行 来自 Apple 的代码。不幸的是,应用程序崩溃了。

已更新:目前模拟器不支持 MetalPerformanceShaders。

从 iOS13 开始,模拟器现在支持 Metal 但没有 Metal Performance Shaders。

如果你想 运行 GPUImage3 在模拟器上你可以改变这个:

if #available(iOS 9, macOS 10.13, *) {
    self.metalPerformanceShadersAreSupported = MPSSupportsMTLDevice(device)
} else {
    self.metalPerformanceShadersAreSupported = false
}

以下内容:

#if targetEnvironment(simulator)
    self.metalPerformanceShadersAreSupported = false
#else
    if #available(iOS 9, macOS 10.13, *) {
        self.metalPerformanceShadersAreSupported = MPSSupportsMTLDevice(device)
    } else {
        self.metalPerformanceShadersAreSupported = false
    }
#endif