hprose / hprose-objc

Hprose is a cross-language RPC. This project is Hprose 2.0 Client for Objective-C
MIT License
130 stars 19 forks source link

UIKIT_EXTERN not defined in Swift-based project for iOS #15

Closed zhangchn closed 6 years ago

zhangchn commented 7 years ago

In Promise.h, the macro PROMISE_QUEUE is dependent on definition (or the lack of) macro UIKIT_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.

andot commented 7 years ago

How can I fix it?

zhangchn commented 7 years ago

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
andot commented 7 years ago

I used UIKIT_EXTERN to distinguish between GUI or CLI.