找不到用Clang构建Mac Catalyst的UIKit / UIKit.h

时间:2020-01-24 20:54:09

标签: ios macos mac-catalyst

我正在使用以下标志为Mac Catalyst构建静态iOS / macOS库:

clang \
  --target=x86_64-apple-ios13-macabi \
  -isysroot /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

这会生成原始的源文件,但失败:

#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import <UIKit/UIKit.h>
#endif

由于已定义TARGET_OS_IPHONE,因此看起来目标标志正在工作。但是,即使在SDK中,也找不到UIKit / UIKit.h:

$ find -L /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -name UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/A/Headers/UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/Current/Headers/UIKit.h
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h

我需要显式指定UIKit框架吗?

1 个答案:

答案 0 :(得分:1)

要完成这项工作的双重机密构建设置为:

FAT_LIB_MAC_CATALYST_FLAGS = -arch x86_64h \
 --target=x86_64-apple-ios13-macabi \
 -isysroot $(MACOSX_SDK_DIR) \
 -isystem $(MACOSX_SDK_DIR)/System/iOSSupport/usr/include \
 -iframework $(MACOSX_SDK_DIR)/System/iOSSupport/System/Library/Frameworks