TARGET_OS_IPHONE and ApplicationTests
The simplest solution is to move the #import <Foundation/Foundation.h>
statement out if the #if
condition and replace Cocoa with AppKit like this:
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
#endif
The Foundation umbrella header imports the NSObjCRuntime header which in turn imports the TargetConditionals header.
You need to add
#include <TargetConditionals.h>
source: https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-8A428/TargetConditionals.h.auto.html