SDL iOS Demo Application Build Failure ApplicationServices.h File Not Found

I’m trying to make the leap from a macOS desktop app built with CMake to an iOS app built with the XCode tool chain.

I figured a good starting point would be to ensure I can build SDL locally with XCode and then to build the demo applications in <SDL>/Xcode-iOS/Demos. SDL seems to build fine via XCode and also via CLI using the <SDL>/build-scripts/ script.

Unfortunately, I can’t build the Demo application in XCode.

It fails with the following error:

…/SDL2-2.0.14/src/video/cocoa/SDL_cocoavideo.h:28:10: ApplicationServices is not available when building for iOS Simulator. Consider using #if TARGET_OS_OSX to conditionally import this framework when building for macOS, first importing TargetConditionals.h if necessary.

And the root cause seems to be:

In file included from …/SDL2-2.0.14/src/video/cocoa/SDL_cocoaevents.m:27:
…/SDL2-2.0.14/src/video/cocoa/SDL_cocoavideo.h:28:10: fatal error: ‘ApplicationServices/ApplicationServices.h’ file not found
#include <ApplicationServices/ApplicationServices.h>
1 error generated.

Has anyone encountered this? What is the correct resolution to this problem? Why is SDL_cocoavideo.h being included for an iOS target?

I suppose it’s the way the project is arranged. SDL is included as a module and it is the compilation of SDL that is the problem. I’m going to try including SDL as an external library instead.