私はAppleのLister (for Apple Watch, iOS, and OS X)サンプルを見ていました。サンプルは、iOSとOS Xのためのテストを実行しますApple Watchのプリプロセッサマクロ?
#import <TargetConditionals.h>
#if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
@import ListerKit;
#elif TARGET_OS_MAC
@import ListerKitOSX;
#endif
しかし、TARGET_OS_WATCH
または同様のための試験は存在しません。 TargetConditionals.h
から
$ cat /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
/SDKs/iPhoneOS7.1.sdk/usr/include/TargetConditionals.h | grep -i watch
$
が、私はそこにいることを知っている:
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
質問:Appleの腕時計のためのプリプロセッサはありTargetConditionals.h
でwatch
のためにgrepをは何のヒットを提供していますか?
私はiosでタグ付けしていますが、私はそれがこの質問に対する正しいOSだか分かりません。
以下のリストは、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
していますか?時計はを省略しますかTARGET_OS_IPHONE
を省略していますか?
[UIApplication sharedApplication]を呼び出す共有マネージャークラスがありますが、このマクロを使用して呼び出すか、上書きすることができます。 – ge0rges