Я смотрел образец 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
или аналогичный. Для watch
оглавлению в TargetConditionals.h
не обеспечивает ни одного хита:
$ cat /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
/SDKs/iPhoneOS7.1.sdk/usr/include/TargetConditionals.h | grep -i watch
$
От 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
Вопрос: Есть ли препроцессор для часов Apple?
Я мечение с ios, но я не уверен, что это правильный OS на этот вопрос.
Список, указанный ниже, был составлен на iPhone TargetConditionals.h
. Simulator и 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
? Имеются ли часы omitTARGET_OS_IPHONE
?
Возможно, у вас есть общий менеджерский класс, который вызывает [UIApplication sharedApplication], который запрещен на часах, но вы знаете, никогда не будет вызывается или может быть перезаписана с помощью этого макроса. – ge0rges