Search code examples
cocoaopengl-esgpuimageios12

GPUImage won't compile on iOS 12


I have these errors:

  1. Cocoa.h File Not Found (in GPUImageView.h)

  2. Unknown Type Name: **NSOpenGLContext, CVOpenGLESTextureCacheRef (GPUImageContext)

Now, I tried to fix all these errors, but ended up making things worse.

I know OpenGL ES is deprecated in iOS 12, but as I understand deprecation, it should still be working for the moment, right?

For error #1, I don't understand what's a MAC OS framework (cocoa.h) doing in here (some of the references are not surrounded with #IFDEF MAC_OS statements).

As for error #2, these types are defined within the AppKit framework (also a MAC_OS framework, not an iOS framework).

I have considered switching to GPUImage2, but it's a ton of work as it's not as easy as swapping the frameworks, I'll have a lot of code to rewrite. I also see Brad Larson (the semi-God behind this framework) has already started working on GPUImage3 which will use Metal instead of OpenGL ES but it's still work-in-progress but it won't be a simple swap from GPUImage v1 to GPUImage v3.


Solution

  • I found a way to fix it. Maybe it will help someone with the same problem. The GPUImage main folder contains the iOS and the MAC projects.

    Go to the framework folder, and delete the GPUImageMac.xcodeproj file.

    Then go to the Source folder located within the framework folder, and delete the whole folder named Mac.

    Clean your project and rebuild. Voilà!

    Good luck!