我正在看苹果的Lister(适用于 Apple Watch、iOS 和 OS X) https://developer.apple.com/library/prerelease/ios/samplecode/Lister/Listings/Objective_C_ListerKitTests_AAPLIncompleteListItemsPresenterTests_m.html样本。该示例针对 iOS 和 OS X 执行测试:
#import <TargetConditionals.h>
#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
@import ListerKit;
#elif TARGET_OS_MAC
@import ListerKitOSX;
#endif
然而,没有测试TARGET_OS_WATCH
或类似的。正在寻找watch
in TargetConditionals.h
不提供点击:
$ cat /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
/SDKs/iPhoneOS7.1.sdk/usr/include/TargetConditionals.h | grep -i watch
$
From 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 32-bit Windows
TARGET_OS_UNIX - Generate code will run under some non Mac OS X unix
TARGET_OS_EMBEDDED - Generate code will run under an embedded OS variant
of TARGET_OS_MAC
TARGET_OS_IPHONE - Generate code will run under iPhone OS which
is a variant of TARGET_OS_MAC.
TARGET_IPHONE_SIMULATOR - Generate code for running under iPhone Simulator
Question: 苹果手表有预处理器吗?
我正在标记ios /questions/tagged/ios,但我不确定这是否是这个问题的正确操作系统。
下面的列表是根据 iPhone 的TargetConditionals.h
。模拟器和 OS X 类似(它们只是将不同的位设置为 1):
#define TARGET_OS_MAC 1
#define TARGET_OS_WIN32 0
#define TARGET_OS_UNIX 0
#define TARGET_OS_EMBEDDED 1
#define TARGET_OS_IPHONE 1
#define TARGET_IPHONE_SIMULATOR 0
问题: 手表有使用吗TARGET_OS_EMBEDDED
?手表有吗omit TARGET_OS_IPHONE
?