pod package 打包因podspec中引入了dependency导致打出来.a库被使用时出现大量的依赖冲突 duplicate symbols for architecture 解决方案

做iOS库文件打包想必一定用过pod package , 最近使用pod做依赖库在使用pod package打包时,因我做的pod lib库的podspec文件中依赖了第三库,如下:

Pod::Spec.new do |s|
  s.name             = 'LWDrawboard'
  s.version          = '1.0.0'
  s.summary          = 'A short description of LWDrawboard.'
    
  。。。。。。。

  s.ios.deployment_target = '8.0'

  s.source_files = 'LWDrawboard/Classes/**/*'
  
  s.resource_bundles = {
    'LWDrawboard' => ['LWDrawboard/Assets/**/*']
  }

  s.public_header_files = 'LWDrawboard/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'

  s.dependency 'Masonry'
  s.dependency 'SDWebImage'
end

使用pod package打包生成的 libLWDrawboard 给其他App使用时,因为其他的App的Podfile也依赖了Masonry、SDWebImage,所以使用方编译App出现了大量的 duplicate symbols ....... 冲突错误。

解决方案:

LWDrawboard 的podspec不用改,只要把在LWDrawboard的Example里Podfile也加上Masonry、SDWebImage这两个依赖,并在pod package打包之前在这个Example下执行 pod install,之后再执行pod package打包,这样打出的.a包就不会重复包含Masonry、SDWebImage的依赖。

pod package LWDrawboard.podspec --force --library --configuration=Release --spec-sources=https://gitlab.com/xxxx/xxxrepo.git,https://github.com/CocoaPods/Specs.git

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

罗哥分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值