已安装Cocoapods
为项目自动更新配置第三方SDK
在终端中操作如下
1.一般cd到.xcodeproj文件所在目录(cd+空格+路径回车)
2.创建Podfile文件(pod init)
3.打开Podfile文件并输入
target '项目名称' do
pod 'SDK名称'
pod 'Masonry' 自动布局
pod 'MJRefresh' 上拉刷新下拉加载
pod 'MBProgressHUD' 等待视图
pod 'SDWebImage' 网络下载图片
pod 'SDWebImage/GIF'
pod 'FLAnimatedImage'
end
4.自动下载SDK(pod install)
5.配置引用路径
选择工程的 Target -> Build Settings 菜单->搜索header,找到"User Header Search Paths";新增一个值"$(PODS_ROOT)",并且选择”recursive”,这样Xcode就会在项目目录中递归搜索文件且会自动找到Pods文件,头文件自动补齐功能就可以用了.
问题一:
Analyzing dependencies
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
Downloading dependencies
Installing BMKLocationKit (1.8.5)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `--.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform `iOS` with version `8.0` on target `--` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[!] The `-- [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods---/Pods---.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `-- [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods---/Pods---.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))
问题二:library not found for -lPods-
解决办法
target -build phases中删除ipods文件
问题三:/usr/bin/git clone https://github.com/SDWebImage/SDWebImage.git /var/folders/dl/n_lt89px4nz64_gqwv6nrmfc0000gn/T/d20200608-1262-1rhixfr --template= --single-branch --depth 1 --branch 4.4.8
解决办法
先sudo gem install cocoapods 后pod install
问题四
library not found for -l
linker command failed with exit code 1 (use -v to see invocation)
解决办法
1.”Build Settings”->”Enable Bitcode”设置为NO
2.TARGETS --> Build Settings --> Architectures --> Valid Architectures 做同样的修改
3.PROJECT --> Build Settings --> Architectures --> Valid Architectures 他的值本来是 armv7 armv7s ,把armv7s 去掉即可
4.PROJECT --> Build Settings --> Architectures -->Build Active Architecture Only的值改变No
5.TARGETS --> Build Settings --> Architectures -->Build Active Architecture Only的值改变No
6. Build settings->Linking->Other Linker Flags 修改为-ObjC