TARGET_OS_IPHONE and ApplicationTests
You need to add
#include <TargetConditionals.h>
source: https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-8A428/TargetConditionals.h.auto.html
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.
I had a similar problem: TARGET_OS_IPHONE
isn't defined when building a static library. My solution was to add "-DTARGET_OS_IPHONE
" to the "Other C Flags
" section of the target build options.