iOS 如何在一个已经存在多个project的workspace中引入cocoapods管理第三方类库

一)

具体方法在

iOS 如何在一个存在多个project的workspace中引入cocoapods管理第三方类库

 

二)Question && Solution

Cocoapods 版本1.0.1

我在按上述链接转换的时候,遇到的问题:

1,

[!] `xcodeproj` was renamed to `project`. Please update your Podfile accordingly.

 

Solution:

 

xcodeproj 'MyProj/MyProj.xcodeproj'

 

just replace xcodeproj to project

 

project 'MyProj/MyProj.xcodeproj'

 

2,eg:

[!] The `Ecosphere [Debug]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `../Pods/Target Support Files/Pods-Ecosphere/Pods-Ecosphere.debug.xcconfig'. This can lead to problems with the CocoaPods installation

    - Use the `$(inherited)` flag, or

    - Remove the build settings from the target.

 

[!] The `Ecosphere [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `../Pods/Target Support Files/Pods-Ecosphere/Pods-Ecosphere.debug.xcconfig'. This can lead to problems with the CocoaPods installation

    - Use the `$(inherited)` flag, or

    - Remove the build settings from the target.

 ......

 

 这种警告是不能忽视的,它带来的直接后果就是无法通过编译。

而产生此警告的原因是项目 Target 中的一些设置,CocoaPods 也做了默认的设置,如果两个设置结果不一致,就会造成问题。

我想要使用 CocoaPods 中的设置,分别在我的项目中定义`PODS_ROOT` 和 `Other Linker Flags`的地方,把他们的值用`$(inherited)`替换掉,

进入终端,执行 pod update 

警告没了,回到 Xcode,build通过。

网上还流行另外一种简单粗暴的方法

点击项目文件 project.xcodeproj,右键`显示包内容`,用文本编辑器打开`project.pbxproj`,删除`OTHER_LDFLAGS`的地方,保存,回到 Xcode,编译通过。

 

因为我的工程已经对 "HEADER_SEARCH_PATHS" 和"OTHER_LDFLAGS"做过配置,

所以 在对应的工程Build Settings中对应的地方填上:

$(inherited) ,解决;

 

3,

在使用cocospods的时候,如果修改了导入的第三方库源文件,那么当使用pod update的时候修改的代码会被作者的原文件覆盖掉。
所以问题来了,遇到确实需要修改源代码的时候,解决方案
1. 不用cocoapods改用手动导入第三方库

2. 将需要修改的第三方库fork一份到自己的github,在里面做完修改之后,将podfile修改为:
platform :ios, '7.0'
pod '要导入的库', :git => 'https://github.com/我的github/要导入的库' 

 

 

前言:

 一种新的第三方库管理工具:Carthage

如何使用Carthage管理iOS依赖库

Podfile Syntax Reference v1.1.0.rc.3

https://guides.cocoapods.org/syntax/podfile.html

 

posted @ 2016-10-10 14:15  尘恍若梦  阅读(3132)  评论(0编辑  收藏  举报