借助modulemap
1.创建modulemap文件
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
module CCommonCrypto [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2.将modulemap路径添加到Import Paths
3.导入头文件使用
tips:如何在pod中使用?
在podspec中添加s.preserve_paths、s.pod_target_xcconfig
s.preserve_paths = 'CocoaPods/**/*'
s.pod_target_xcconfig = {
'SWIFT_INCLUDE_PATHS[sdk=macosx*]' => '$(PODS_ROOT)/JRString/CocoaPods/macosx',
'SWIFT_INCLUDE_PATHS[sdk=iphoneos*]' => '$(PODS_ROOT)/JRString/CocoaPods/iphoneos',
'SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]' => '$(PODS_ROOT)/JRString/CocoaPods/iphonesimulator',
'SWIFT_INCLUDE_PATHS[sdk=appletvos*]' => '$(PODS_ROOT)/JRString/CocoaPods/appletvos',
'SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]' => '$(PODS_ROOT)/JRString/CocoaPods/appletvsimulator',
'SWIFT_INCLUDE_PATHS[sdk=watchos*]' => '$(PODS_ROOT)/JRString/CocoaPods/watchos',
'SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]' => '$(PODS_ROOT)/JRString/CocoaPods/watchsimulator'
}
注意:pod lib lint 校验不会通过,提交时可跳过此步直接push