iOS 与 CocosCretor之间的对接问题。

对接出现的问题一:

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

是否觉得警告没啥,然后就忽略了。那你就会跟我一样,走进坑里。花大把时间去试错。
如果不解决这个waring,那么接下来编译时,工程就会报错:

library not found for -XXX

出现这个错误,最先想到的是去 build setting 设置 libaary search path 中添加确实的Library
博主第一反应也是这样做的,找了一大圈,设置了一大堆然冰暖。

而实际 上面的错误都是因为cocopods 的那个warning 引起的,其实 cocopods 已经给出提示且给出解决方案了(Use the $(inherited) flag) ,跟着做就好了。
HEADER_SEARCH_PATHS(警告报错的地方) 加入$(inherited) 就可以了。把所有的警告都处理掉,重新运行,你就能发现新大陆了。

对接出现的问题二:
当你cocoapods 一些SDK以后,一切顺利,但是编译后蹦出来:

The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

然后你就跟着pod install ,跟着pods update。。缺发现,没用。why?这时候就一脸懵。
查看报错信息,你就会发现,有额外的路径提示

diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory

找了一圈发现好像没什么作用。百思不得其解
这时候你要是去看cocoapods的警告,你可能就会发现,你在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 `XXXX-mobile` to `Target Support Files/Pods-XXXX-mobile/Pods-XXXX-mobile.debug.xcconfig` or include the `Target Support Files/Pods-XXXX-mobile/Pods-XXXX-mobile.debug.xcconfig` in your build configuration (`ios/UserConfigIOS.debug.xcconfig`).

[!] 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 `XXXX-mobile` to `Target Support Files/Pods-XXXX-mobile/Pods-XXXX-mobile.release.xcconfig` or include the `Target Support Files/Pods-XXXX-mobile/Pods-XXXX-mobile.release.xcconfig` in your build configuration (`ios/UserConfigIOS.release.xcconfig`).

现在你只需要把对应的.xcconfig添加到Cocos Creator的.xcconfig里,就能解决你的问题了。

image.png

记得两个文件都要哟,区分好debug与release。

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974

#include "../../cocos2d-x/cocos/platform/ios/CCModuleConfigIOS.debug.xcconfig"
//添加下面这行代码。
#include "../Pods/Target Support Files/Pods-你的项目名称-mobile/Pods-你的项目名称-mobile.debug.xcconfig"

添加完以后,编译,新世界欢迎你。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容