我们的项目是OC与Swift混编项目.
前段时间,接手的时候,pod不可用,一pod install就各种报错\编译不过\crash.
于是抽了个时间准备静下心来解决这件事.
1.首先拉了个分支
fixPod
2.pod一下项目
$ pod install
之后,出现下面两行黄色警告.
[!] The `LifeVC [Debug]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in
`Pods/Target Support Files/Pods-LifeVC/Pods-LifeVC.debug.xcconfig'. This can lead to problems
with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `LifeVC [Release]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in
`Pods/Target Support Files/Pods-LifeVC/Pods-LifeVC.release.xcconfig'. This can lead to problems
with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
此警告不可忽略,否则走弯路了.
3.解决警告:
参考文章:https://www.bbsmax.com/A/LPdo6qg853/
真正起作用的是这句话:
点击项目文件 project.xcodeproj,右键`显示包内容`,
用文本编辑器打开`project.pbxproj`,删除`OTHER_LDFLAGS`及其包含的东西,删除`HEADER_SEARCH_PATHS `及其包含的东西,
保存,回到 Xcode,编译通过。
4.运行崩溃在这里了
dyld: Library not loaded: @rpath/AFNetworking.framework/AFNetworking
Referenced from: Users/XXXXX/Library/Developer/CoreSimulator/Devices/XXXXX/data/Containers/Bundle/Application/XXXXX/XXXXX.app/XXXXX
Reason: image not found
解决:
参考:https://www.cnblogs.com/meilj/p/10757022.html
执行 `pod deintegrate` 再重新安装 `pod install`
新警告出来了,非混编项目可能不会出现:
[!] The `LifeVC [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-LifeVC/Pods-LifeVC.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `LifeVC [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-LifeVC/Pods-LifeVC.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
解决方法:
参考:http://www.coderlord.com/ios/2/1/2/F27FB141572212.html
点击项目文件 project.xcodeproj,右键`显示包内容`,
用文本编辑器打开`project.pbxproj`,删除`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`及其包含的东西
保存,回到 Xcode,编译通过。
正常pod了 一个警告都没了.
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 24 dependencies from the Podfile and 25 total pods installed.
ok,运行成功,一切回归正常.pod能正常使用了.