cocoapods 引入 三方库 历程

在已有的工程中没有使用 pod, 新建一个demo手动导入protobuf时报错GPB文件找不到,直接使用pod导入没有出现类似错误,所以就在项目工程中引入pod去集成protobuf

platform :ios, '8.0'
use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'
target 'Project' do
  pod 'Protobuf'
end

直接运行 pod install 安装成功,出现了 感叹号❗️,并且编译工程失败,framework not found Protobuf

[!] The `CarShare [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-CarShare/Pods-CarShare.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `CarShare [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-CarShare/Pods-CarShare.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

尝试消除 感叹号❗️

  • Target - > building settings中搜索 “ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES”,值类型是bool,点击other,把值换成 $(inherited) 之后 运行 pod update / pod install 依然出现 感叹号❗️
  • 在Build Setting中的Search Path下的Framework Search Paths与Header Search Paths中添加$(inherited)。 工程里已经是了
  • 在Build Setting中的Linking下的Other Linker Flags下也要添加$(inherited) ----感叹号❗️就此消失,但是工程还是编译失败 framework not found Protobuf

然后解决 framework not found的问题。搜到了一些方法

  1. Target->BuildSetting->Library Search Path添加以$(PROJECT_DIR)/开始的相对路径
  2. Other Linker Flag发现多余的头文件并删除
  3. 在product-》edit scheme中-》build里面添加pods的所有的库
  4. 删除pod的四个文件,重新创建
  5. 在cocoapods的官网Troubleshooting找解决办法
  6. 更改pods-》project-》architectures-》build active architecture only都为NO,

1.使用相对路径无效;2.Other Linker Flag里没有多余的文件;3.在scheme中添加pods的库没有尝试;4.删除pod重新添加无效;5. 6.解决问题。

之后我把项目回滚到引入 pod之前,然后pod install,依然会出现感叹号❗️ 但工程编译成功,跑了一遍流程,没任何问题,好吧pod给我开了一个玩笑, 在 other linker flags 下添加 $(inherited) 消除 感叹号❗️,pod有时候就爱开玩笑,回头尝试一下Carthage会不会出现类似的问题

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值