Closed zhangchn closed 6 years ago
How can I fix it?
If you want to distinguish iOS/tvOS/macOS/simulator from each other, use TARGETOS* macros defined in TargetConditionals.h
:
TARGET_OS_*
These conditionals specify in which Operating System the generated code will
run. Indention is used to show which conditionals are evolutionary subclasses.
The MAC/WIN32/UNIX conditionals are mutually exclusive.
The IOS/TV/WATCH conditionals are mutually exclusive.
TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
TARGET_OS_MAC - Generated code will run under Mac OS X variant
TARGET_OS_OSX - Generated code will run under OS X devices
TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
TARGET_OS_IOS - Generated code will run under iOS
TARGET_OS_TV - Generated code will run under Apple TV OS
TARGET_OS_WATCH - Generated code will run under Apple Watch OS
TARGET_OS_BRIDGE - Generated code will run under Bridge devices
TARGET_OS_SIMULATOR - Generated code will run under a simulator
TARGET_OS_EMBEDDED - Generated code for firmware
TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR
TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH
I used UIKIT_EXTERN to distinguish between GUI or CLI.
In
Promise.h
, the macroPROMISE_QUEUE
is dependent on definition (or the lack of) macroUIKIT_EXTERN
. In a Swift based project built with recent SDKs,UIKIT_EXTERN
is not imported from ObjC headers, leading to potential race conditions upon promise fulfillment and non-main-thread call to UI API issues.