TARGET_OS_IPHONE and ApplicationTests

Matt Baker picture Matt Baker · Sep 18, 2010 · Viewed 15.1k times · Source

Why doesn't this code work when compiling an ApplicationTests unit test bundle?

#if TARGET_OS_IPHONE
   #import <Foundation/Foundation.h>
   #import <UIKit/UIKit.h>
#else
   #import <Cocoa/Cocoa.h>
#endif

One of my dependencies has this check and compiles just fine in my main application bundles, but it tries to load <Cocoa/Cocoa.h> when compiling my ApplicationTests bundle. It's probably just my lack of understanding of Xcode, but I get nervous when my test bundles don't build. Any suggestions?

Answer

antho picture antho · Jun 21, 2012