美文网首页
Cocoapod 常用备记

Cocoapod 常用备记

作者: 大刘 | 来源:发表于2022-10-21 14:16 被阅读0次

指定源 Source

source 'https://github.com/aliyun/aliyun-specs.git'
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

本地引用

pod 'MyModule', :path => '/Users/daliu/Documents/Modules/MyModule'

基于远程分支引用

pod 'MyModule', :git => 'http://.../MyModule.git', :branch => 'dev'

基于某一次提交引用

pod 'DLTest', :git => 'git@gitlab.daliu.net:rjhy/app/base/ios/DLTest.git', :commit => '22ea695e1335caae2a8a2cbf2667a79bf81228aa'

跳过 pod repo update

pod update --no-repo-update

版本指定

image.png

配置只在测试环境使用

pod 'AMLeaksFinder', :configurations => ['DEBUG']

适配Xcode 14 真机pod工程中bundle target签名报错

post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
end
end
end

执行podlint报错

执行pod spec lint的时候报了一个错误

ld: in /var/folders/.../Pods/YYKit/Vendor/WebP.framework/WebP(anim_decode.o), building for iOS Simulator, but linking in object file built for iOS, file '/var/folders/w8/.../Pods/YYKit/Vendor/WebP.framework/WebP' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题分析:YYKit/WebP.framework中没有arm64
解决方法:在podspec指定模拟器排除arm64架构

s.pod_target_xcconfig = { 
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' 
}
 s.user_target_xcconfig = { 
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' 
}

相关文章

网友评论

      本文标题:Cocoapod 常用备记

      本文链接:https://www.haomeiwen.com/subject/zigpzrtx.html