1. unity導出xcode工程有兩種模式,一種為模擬器運行的工程,一種為真機運行的工程,這里遇到的錯誤,都是導出模擬器運行工程時報的錯誤。
錯誤1:
unity UnityMetalSupport Duplicate interface definition for class 'CAMetalLayer'
解決方案:
//把報錯的地方的代碼替換為下方代碼: @interface CAMetalLayer (category) @property (readwrite) BOOL framebufferOnly; @property (readwrite) CGSize drawableSize; @property BOOL presentsWithTransaction; @property (readwrite, retain) id<MTLDevice> device; @property (readwrite) MTLPixelFormat pixelFormat; @property (readonly) id<MTLTexture> texture; - (id<CAMetalDrawable>)newDrawable; - (id<CAMetalDrawable>)nextDrawable; @end
錯誤2:
Typedef redefinition with different types ('void *' vs 'struct __CVMetalTextureCach
解決方案:
解決方法很簡單,在CVTextureCache.mm文件中,全局替換:
把 CVMetalTextureCacheRef 替換為 UCVMetalTextureCacheRef、
把 CVMetalTextureRef 替換為 UCVMetalTextureRef。
參考: