相关疑难解决方法(0)

Apple Watch的预处理器宏?

我正在看Apple的Lister(Apple Watch,iOS和OS X)样本.该示例对iOS和OS X执行测试:

#import <TargetConditionals.h>

#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)

@import ListerKit;

#elif TARGET_OS_MAC

@import ListerKitOSX;

#endif
Run Code Online (Sandbox Code Playgroud)

但是,没有测试TARGET_OS_WATCH或类似.Grepping for watchin TargetConditionals.h不会发出命中:

$ cat /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
  /SDKs/iPhoneOS7.1.sdk/usr/include/TargetConditionals.h | grep -i watch
$
Run Code Online (Sandbox Code Playgroud)

TargetConditionals.h,我知道有:

    These conditionals specify in which Operating System the generated code will
    run. The MAC/WIN32/UNIX conditionals are mutually exclusive.  The EMBEDDED/IPHONE 
    conditionals are variants of TARGET_OS_MAC. 

        TARGET_OS_MAC           - Generate code will run under Mac OS
        TARGET_OS_WIN32         - Generate code will run under …

preprocessor ios c-preprocessor watchkit watchos-2

12
推荐指数
3
解决办法
7242
查看次数

标签 统计

c-preprocessor ×1

ios ×1

preprocessor ×1

watchkit ×1

watchos-2 ×1