MTLRender error - iOS & ofxARkit

I’m wanting to fiddle around with OF and ofxARkit but when compiling xCode gives the following error:

2018-12-14 00:32:07.908845+0200 tracAR_1[4033:684945] -[MTLRenderPipelineDescriptorInternal validateWithDevice:], line 2395: error 'vertexFunction must not be nil.'

-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2395: failed assertion `vertexFunction must not be nil.'

As a test I’ve just compiled my generated project with all code from the ‘example-basic’ that comes with ofxARkit. Because of the error I’ve tried to fix all differences between the files but can’t seem to get to the right fix.

Wonder if there is somebody out there that can help me fix this, as it doesn’t seem to be part of the code itself but more of some setting somewhere in xCode. For the sake of being able to try my exact compile I’ve pushed everything to github:

I’m compiling to a iPad Pro running iOs 12.1.1

Thanks in advance!

Same problem here, anyone?

So I eventually solved the problem just replicated it in order to clearly show how to solve this error. It’s actually communicated on the ofxARkit wiki on Github but in a way that might not be clear to everyone if you haven’t been working in Xcode much.

ofxARkit wiki -**

  • When creating a new project, the .metal file that contains the shader for processing the camera image is for some reason, marked as a data file instead of a metal shader source. Also, the file is not included in the list of compiled sources. You’ll have to change how XCode views that file as well as add it to the list of compiled sources.**

Follow these steps

  • In Xcode navigate to: addons > ofxARKit > src > lib > Shaders.metal
  • Click the file.
  • Make sure you open the file inspector by clicking the icon in the top right corner.
  • The ‘type field’ will display data. Click the field and change it to Metal Shader Source.

This should make sure Xcode reads this file correctly and will solve the renderer problem.
Let me know if all works out. :wink:


same error.

The solution did it for me, so thanks @RobbertGroenendijk .

I had to tick the Target Membership below though, on Mac 10.14.1 with an Iphone model XS A2097 running iOS 12.1.3 .


Just started a new ARkit project and wanted to confirm this as well. Running on an iPad Pro with iOS 12.1.4.


This combo of solutions worked for me as well. I also had to tick the Target Membership box.

Thanks to the previous responders!

Thanks! Had the same problem, and this solution is still working in 2021