在开发私有库的时候,当使用pod lib lint来校验,总会出现各种错误,下面是一些我遇到的错误和解决方法。
1错误
/var/folders/ml/7mbbhqz17jb4m792nxvm3gg40000gn/T/CocoaPods-Lint-20211109-82561-cg4m9z-XDTTool/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'UMCSecurityPlugins' from project 'Pods') ** BUILD FAILED **
1修复
在pod lib lint命令的后面添加--skip-import-validation
2错误
The Swift podaaadepends uponbbb, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers!globally in your Podfile, or specify:modular_headers => truefor particular dependencies.
2修复
命令后面添加--use-modular-headers
3错误
ERROR | [iOS] unknown: Encountered an unknown error (The 'Pods-App' target has transitive dependencies that include statically linked binaries: (/private/var/folders/ml/7mbbhqz17jb4m792nxvm3gg40000gn/T/CocoaPods-Lint-20211109-84702-ckaqwb-XDTTool/Pods/UMCSecurityPlugins/thirdparties/SecurityEnvSDK.framework and /private/var/folders/ml/7mbbhqz17jb4m792nxvm3gg40000gn/T/CocoaPods-Lint-20211109-84702-ckaqwb-XDTTool/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework)
3修复
在podfile中的修复方式如下:
pre_install do |installer|
// workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
在pod lib lint的修复方法是给命令后面加--use-libraries
4错误
ERROR | [iOS] unknown: Encountered an unknown error (CocoaPods could not find compatible versions for pod "aaa": None of your spec sources contain a spec satisfying the dependency:aaa (= 0.2.6)`.
You have either:
- out-of-date source repos which you can update with
pod repo updateor withpod install --repo-update. - mistyped the name or version.
- not added the source repo that hosts the Podspec to your Podfile. `
4修复
错误的意思是说aaa这个库在CocoaPods里面找不到。如果是公有库,那么可以试试pod repo update or with pod install --repo-update.而我这里是因为私有库里面引用了私有库,那肯定找不到。
在podfile里面修复是在podfile文件的顶部添加下面的代码指定source
source 'https://github.com/CocoaPods/Specs.git'
source 'https://a.com/aa/aaa.git'
pod lib lint的修复如下
pod lib lint --sources='https://github.com/CocoaPods/Specs.git,https://a.com/aa/aaa.git'