How to specify Metal Shader Language version?

My app got Binary Rejected for the third time. The crashlogs are no help (I've symbolized them, but they do not contain any print logs...).

Runs fine on iPhone 6s, iPhone X and iPad Pro 12.9

I'm testing on iOS 12 with app target iOS 11

As Metal for iOS can not be run in the simulator, I have not tested on iOS 11

So I got Crashlytics and got some info for the crash_info_entry_0 key:

...Error Domain=AGXMetalA8X Code=3 "Function ... is using language version 2.1 which is incompatible with this OS."...

It occurred on an iPad Air 2 (A8) running iOS 11.4.1

So I guess the problem is that iOS 11 dose not support Metal language version 2.1

How do I change the language version to 2.0?


After checking my Metal Lib, it did indeed have a target of iOS 12. Tho it ran fine with app target of iOS 11. I've now changed the Metal Lib target to iOS 11, I hope that changes the Metal Language Version too...

I wish the Compiler or App Store Uploader would catch this.

1 answer

  • answered 2018-10-11 22:49 warrenm

    In targets that contain Metal code, there is a build setting called "Metal language revision" (the actual key is MTL_LANGUAGE_REVISION, and valid values include Metal12 and Metal20, corresponding to language versions 1.2 and 2.0, respectively) that allows you to specify your preferred MSL version. When not set, this setting choses a default that is suitable for the current SDK and deployment target, which seems to be overly aggressive in your case. If you aren't using MSL 2.1 features, you can explicitly set this to "Metal 2.0" in the Build Settings section of your target's settings.