使用CocoaPods管理第三方框架非常方便,但是有时候也会出现一些问题。
问题来源
今天下载了Coding源码,打算研究一下。按照提示执行了脚本之后发现,还是会报这么一个错误:
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
问题解决
于是我就重新pod install
发现还是不行,接着就是各种Google
,然后找到了这种方法:
//先把项目的Myproject.workspeace删除
rm -rf MyProject.xcworkspace
//再重新pod
pod install
按照步骤执行了之后,发现还是不行。(但是好像是有的人这么解决就可以。)
然后我发现在pod install
的时候,终端会有这么两个提示:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Coding_iOS` to `Pods/Target Support Files/Pods-Coding_iOS/Pods-Coding_iOS.debug.xcconfig` or include the `Pods/Target Support Files/Pods-Coding_iOS/Pods-Coding_iOS.debug.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Coding_iOS` to `Pods/Target Support Files/Pods-Coding_iOS/Pods-Coding_iOS.release.xcconfig` or include the `Pods/Target Support Files/Pods-Coding_iOS/Pods-Coding_iOS.release.xcconfig` in your build configuration.
然后抓住这个线索我又找到了最终解决办法:
先在项目里把下面的Configuration
都改为None
,然后在pod install
。这样就解决了。
2016-6-14补充
在我新项目里,我设置了多个target,用cocoaPods又出现了下面的错误。
[!] The `PuHuaHospital [Release]` target overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting defined in `Pods/Target Support Files/Pods-PuHuaHospital/Pods-PuHuaHospital.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `PuHuaHospitalDoctor [Release]` target overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting defined in `Pods/Target Support Files/Pods-PuHuaHospitalDoctor/Pods-PuHuaHospitalDoctor.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
解决办法:
在Build Settings
Header Search Paths
Other Linker Flags
Preprocessor Macros
在这三个地方都加上$(inherited)
,然后重新pod install
就可以了。
如果有不明白的,请给我留言,谢谢。多谢支持~