记一次 CocoaPod 的使用过程

目前有一个cocos2d creator项目, 接入了微信SDK,  现在需要接入阿里云移动推送.

用到了CocoaPod集成.   于是创建了一个Podfile, (此文件在项目目录中, 和 xxxxxxxx.xcodeproj 同一路径 )

source 'https://github.com/CocoaPods/Specs.git' 
source 'https://github.com/aliyun/aliyun-specs.git'
project 'HaloNativeIOS.xcodeproj'

target 'HaloNativeIOS-mobile' do
    platform :ios, '10.0'
    
    pod 'AlicloudPush', '~> 1.9.9.1'
end

接着在Podfile文件路径下,  执行pod install

➜  proj.ios_mac git:(master) ✗ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Volumes/dzqExt/source/engine/cocos2d-x-3.17.2/templates in PATH, mode 040777
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.

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

[!] The `HaloNativeIOS-mobile [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-HaloNativeIOS-mobile/Pods-HaloNativeIOS-mobile.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

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

  第一次使用cocoapod,  碰到这些感叹号, 有点头皮发麻.   没办法工作还得继续.  一个一个解决就好了.

第一个感叹号的问题(debug模式)和第二个反馈的问题(release) 可以看作是一样的, 基本可以一起处理了

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

 大概意思:

CocoaPods未设置项目的基本配置,因为我的项目已经有了自定义配置集。为了使CocoaPods完美工作, 请设置

1:  设置 HaloNativeIOS-mobile 目标的基本配置为: Target Support Files/Pods-HaloNativeIOS-mobile/Pods-HaloNativeIOS-mobile.debug.xcconfig

或者

2: 在ios/UserConfigIOS.debug.xcconfig文件中包含 Target Support Files/Pods-HaloNativeIOS-mobile/Pods-HaloNativeIOS-mobile.debug.xcconfig

看懂了解决办法后,开始实操:

设置后: 

然后关闭Xcode, 重新pod install

非常完美, 错误少了一大截.  继续解决.

重新执行命令后, 只反馈了两个问题,并且这两个基本上可以看作一样的. 解决了debug, 那么release也就迎刃而解了

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

大概意思:

 “ HaloNativeIOS-mobile [Debug]”目标会覆盖“Pods/Target Support Files/Pods-HaloNativeIOS-mobile/Pods-HaloNativeIOS-mobile.debug.xcconfig'”中定义的“ FRAMEWORK_SEARCH_PATHS”构建设置。 这可能会导致CocoaPods安装出现问题

当前工程设置:

FRAMEWORK_SEARCH_PATHS的路径为bugly库的路径.

Pod目录下的配置:

FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AlicloudPush/push" "${PODS_ROOT}/AlicloudUT/ut" "${PODS_ROOT}/AlicloudUTDID/utdid" "${PODS_ROOT}/AlicloudUtils/utils"

 很明显覆盖,  因为2个库都在使用, bugly是原始方式集成的, 而阿里推送是使用pod方式集成.  

2个都需要使用:  

添加一个$(inherited) , 选项即可

重新pod install

非常完美, 所以感叹号消息

原文地址:https://www.cnblogs.com/dzqdzq/p/12766371.html