Search code examples
iosswiftmetal

Swift Metal MTLCreateSystemDefaultDevice returns nil


I try to develop something on Metal iOS and receive the following error:

Code:

let device = MTLCreateSystemDefaultDevice()!

Error:

Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value

I'm on xcode 9.4.1

iOS SDK: 11.4

Architecture: arm64 armv7 armv7s

Can someone please help.


Solution

  • Test it on real device iPhone or iPad, it will not work on Simulator.