使用编译检查命令:pod spec lint BITBluetoothEntity.podspec --sources='http://192.168.1.156:8888/bitinfo_tech_ios/BitInfoTechSpec.git,https://github.com/CocoaPods/Specs.git' --verbose
BITBluetoothEntity.podspec文件依赖库:
s.frameworks = 'UIKit', 'Foundation' s.dependency 'BITFDCategories' s.dependency 'BITCommonUnitKeys' s.dependency 'BITYYKit' s.dependency 'YYCategories' s.dependency 'FMDB' s.dependency 'MJExtension' s.dependency 'BITAESCryptUtils' s.dependency 'ReactiveCocoa', '~> 2.5'
编译报错部分:
- ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/BITBluetoothReceive.h:18:9: error: - NOTE | [iOS] xcodebuild: error: include of non-modular header inside framework module 'BITBluetoothEntity.TimeRsp': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITAESCryptUtils/BITAESCryptUtils.framework/Headers/NSData+Add.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/RspResponse.h:13:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.RspResponse': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITYYKit/BITYYKit.framework/Headers/YYThreadSafeDictionary.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/Transmission.h:11:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.Transmission': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITYYKit/BITYYKit.framework/Headers/YYThreadSafeArray.h' [-Werror,-Wnon-modular-include-in-framework-module] - NOTE | [iOS] xcodebuild: fatal error: could not build module 'BITBluetoothEntity' - ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/BITJsWebEntity.h:10:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.BITJsWebEntity': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITCommonUnitKeys/BITCommonUnitKeys.framework/Headers/BITCommonUnitKeys.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/BLELockInfo.h:12:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.BLELockInfo': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITYYKit/BITYYKit.framework/Headers/YYThreadSafeArray.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/MessageEntity.h:11:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.MessageEntity': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITAESCryptUtils/BITAESCryptUtils.framework/Headers/NSString+Hex.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/Rsp.h:11:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.Rsp': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITAESCryptUtils/BITAESCryptUtils.framework/Headers/NSString+Hex.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/BITBluetoothReceive.h:18:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.BITBluetoothReceive': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITCommonUnitKeys/BITCommonUnitKeys.framework/Headers/BITCommonUnitKeys.h' [-Werror,-Wnon-modular-include-in-framework-module] - ERROR | [iOS] xcodebuild: /Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITBluetoothEntity/BITBluetoothEntity.framework/Headers/TimeRsp.h:10:9: error: include of non-modular header inside framework module 'BITBluetoothEntity.TimeRsp': '/Users/jiaguoshang/Library/Developer/Xcode/DerivedData/App-domhveplqxcmftbyroldcufbprbx/Build/Products/Release-iphonesimulator/BITAESCryptUtils/BITAESCryptUtils.framework/Headers/NSData+Add.h' [-Werror,-Wnon-modular-include-in-framework-module] - NOTE | [iOS] xcodebuild: /var/folders/4y/m9ckznh17111xdfwvn7xg0w40000gn/T/CocoaPods-Lint-20190228-23879-ihbwb1-BITBluetoothEntity/App/main.m:3:9: fatal error: could not build module 'BITBluetoothEntity' Analyzed 1 podspec. [!] The spec did not pass validation, due to 10 errors and 44 warnings.
原因很简单在后面加上--use-libraries在执行就可以了。完整的命令是:BITBluetoothEntity.podspec --sources='http://192.168.1.156:8888/bitinfo_tech_ios/BitInfoTechSpec.git,https://github.com/CocoaPods/Specs.git' --verbose --use-libraries
有告警可以使用-allow-warnings忽略。