ios Cocoapods 警告 - CocoaPods 没有设置您项目的基本配置,因为您的项目已经有一个自定义配置集
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26287103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cocoapods Warning - CocoaPods did not set the base configuration of your project because because your project already has a custom config set
提问by seanoshea
After I execute a pod install
at the base of my project, I get the following error:
在pod install
项目的基础上执行 a 后,出现以下错误:
CocoaPods did not set the base configuration of your project because 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
BluePlaquesLondonFramework
toPods/Target Support Files/Pods/Pods.debug.xcconfig
or include thePods/Target Support Files/Pods/Pods.debug.xcconfig
in your build configuration.
CocoaPods 没有设置您项目的基本配置,因为您的项目已经有一个自定义配置集。为了让 CocoaPods 集成工作,请将目标的基本配置设置
BluePlaquesLondonFramework
为Pods/Target Support Files/Pods/Pods.debug.xcconfig
或包含Pods/Target Support Files/Pods/Pods.debug.xcconfig
在您的构建配置中。
This probably sounds like a silly question, but how do I set the base configuration for a target?
这可能听起来像一个愚蠢的问题,但我如何为目标设置基本配置?
https://github.com/seanoshea/BluePlaquesLondon/blob/ios8/Podfileis the Podfile which is causing this issue.
https://github.com/seanoshea/BluePlaquesLondon/blob/ios8/Podfile是导致此问题的 Podfile。
http://github.com/seanoshea/BluePlaquesLondonon the iOS 8 branch is the Podfile in question if you're curious to see what the project looks like.
http://github.com/seanoshea/BluePlaquesLondon在 iOS 8 分支上是有问题的 Podfile,如果你想看看这个项目是什么样子的。
回答by TimD
I had the same problem, but in Xcode 6.1.1 - what fixed it for me was to change the configuration file setting to None
for the two Pods-related targets, then run pod install
again.
我遇到了同样的问题,但在 Xcode 6.1.1 中 - 对我来说修复它的是将配置文件设置更改None
为两个与 Pods 相关的目标,然后pod install
再次运行。
The configuration file setting is found by selecting the project (not the target) and then the Info tab.
通过选择项目(而不是目标),然后选择信息选项卡,可以找到配置文件设置。
回答by SwiftArchitect
Don't tinker, Reset.
不要修补,重置。
Step-by-step
一步步
- Show Project Navigator
- Select Project
- Select
Info
- In Configurations, select each one, one at a time (Debug, ApplicationUnitTest, Release, etc.), and for each target within said configuration, set configuration to None.
- Make certain that Based on Configuration Filereads 0 Configurations Setor No Configurations Setfor eachconfiguration. That is the crux.
- QuitXcode
rm -rf Pods/ Podfile.lock ; pod install
- 显示项目导航器
- 选择项目
- 选择
Info
- 在Configurations 中,一次选择一个(Debug、ApplicationUnitTest、Release 等),并且对于所述配置中的每个目标,将 configuration 设置为None。
- 确保基于配置文件为每个配置读取0 Configurations Set或No Configurations Set。这就是症结所在。
- 退出Xcode
rm -rf Pods/ Podfile.lock ; pod install
Once you have allowed pod install
in step 7
to do its magic, you may be able to use a custom config and change your configurations.
一旦您允许pod install
逐步7
发挥其魔力,您就可以使用自定义配置并更改您的配置。
回答by quark
Go into XCode and open your project settings and under the Info tab, you will see "Configurations" where you can set a configuration file for both Debug and Release. You apparently have already set these to some custom config and CocoaPods wants/needs you to use the Pods config.
进入 XCode 并打开您的项目设置,在“信息”选项卡下,您将看到“配置”,您可以在其中为调试和发布设置配置文件。您显然已经将这些设置为一些自定义配置,而 CocoaPods 想要/需要您使用 Pods 配置。
回答by Chris Fellows
Ran into the same problem. It would build on the simulator but not on my device. None of the answers solved this for me. Here's what I did piecing some answers together:
遇到了同样的问题。它会建立在模拟器上,但不会建立在我的设备上。没有一个答案为我解决了这个问题。以下是我拼凑的一些答案:
Changed my pods file to use a specific target:
target :MyProject do pod 'AWSCognitoSync' pod 'Facebook-iOS-SDK' end
Ran pod install
- That gives an error:
[!] 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 `MyProject` to `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig` or include the `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig` in your build configuration.
- Go Project settings and click on Info tab. There will be an error where it cannot find the Configuration file. Set it to "None" for Debug and Release.
- Run pod install yet again
- Clean and build. This works.
更改了我的 pods 文件以使用特定目标:
target :MyProject do pod 'AWSCognitoSync' pod 'Facebook-iOS-SDK' end
运行 pod 安装
- 这给出了一个错误:
[!] 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 `MyProject` to `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig` or include the `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig` in your build configuration.
- 转到项目设置并单击信息选项卡。找不到配置文件会报错。将其设置为“无”以进行调试和发布。
- 再次运行 pod install
- 清洁和建造。这有效。
回答by ReDetection
You should also make sure that you have no pods in the root of Podfile
, you should define all the pods that are used in many targets like that:
您还应该确保在 的根目录中没有 pod Podfile
,您应该像这样定义在许多目标中使用的所有 pod:
def shared_pods
pod 'ReactiveCocoa', '~> 2.5'
end
target 'app' do
shared_pods
pod 'RestKit'
end
target 'tests' do
shared_pods
pod 'OCMock'
end
You also might need to delete libPods.a
and libPods-app.a
from the target dependencies, perform a clean and then run pod install
again.
您可能还需要从目标依赖项中删除libPods.a
和删除libPods-app.a
,执行清理然后pod install
再次运行。
回答by Hodson
I just ran into this issue after adding some custom build configurations. I could see under:
在添加了一些自定义构建配置后,我刚刚遇到了这个问题。我可以在下面看到:
Pods (target) > Target Support Files > Pods
that it had actually created the new xcconfig
files that matched the new build configurations but for some reason I could not select these in the project target of my app.
它实际上创建了xcconfig
与新构建配置匹配的新文件,但由于某种原因,我无法在我的应用程序的项目目标中选择这些文件。
What fixed it for me was to install and use cocoapods-deintegrate:
对我来说修复它的是安装和使用cocoapods-deintegrate:
gem install cocoapods-deintegrate
and then run:
然后运行:
pod deintegrate
followed by:
其次是:
pod install
回答by fred foc
The line in the podfile that is generating a problem is : link_with ['BluePlaquesLondon', 'BluePlaquesLondonFramework'].
podfile 中产生问题的行是:link_with ['BluePlaquesLondon', 'BluePlaquesLondonFramework']。
Just make this : link_with ['BluePlaquesLondon'] or this (worked in my case, hope it will in yours :-)) :
只需这样做:link_with ['BluePlaquesLondon'] 或此(在我的情况下有效,希望它适用于您的 :-)):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
xcodeproj 'BluePlaquesLondon.xcodeproj'
inhibit_all_warnings!
link_with ['BluePlaquesLondon']
def import_pods
pod 'TTTAttributedLabel', '~> 1.10.1'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.0.9'
pod 'Google-Maps-iOS-SDK'
pod 'IntentKit'
pod 'HCViews'
pod 'SVProgressHUD', :head
pod 'iRate'
pod 'iOS-KML-Framework', :git => 'https://github.com/FLCLjp/iOS-KML-Framework.git'
end
import_pods
target "BluePlaquesLondonFramework" do
import_pods
pod 'Kiwi'
end
回答by diegoreymendez
If you added a custom build configuration to your existing project, Cocoapods will complain about it.
如果您在现有项目中添加了自定义构建配置,Cocoapods 会抱怨它。
Cocoapods will automatically create xcconfig files under the directory Pods/Target Support Files/<build_target>
following the naming pattern Pods-<build_target>.<build_config>.xcconfig
.
Cocoapods 将Pods/Target Support Files/<build_target>
按照命名模式在目录下自动创建 xcconfig 文件Pods-<build_target>.<build_config>.xcconfig
。
Just make sure to manually add those files to your project in Xcode (under the Pods directory, but not inside the Pods project!). Once those files are included select your project in Xcode, go to the "Info" tab, and expand your custom configuration. Select the appropriate xcconfig file for each target under your custom configuration.
只需确保将这些文件手动添加到 Xcode 中的项目中(在 Pods 目录下,但不在 Pods 项目中!)。包含这些文件后,在 Xcode 中选择您的项目,转到“信息”选项卡,然后展开您的自定义配置。为自定义配置下的每个目标选择适当的 xcconfig 文件。
回答by lukszar
I had the same error while pod install. I tried everything (reinstall pod, update all gems, etc.) and I found solution worked in my case. There was problem because of changing target's name. In this case solution is simple:
我在安装 pod 时遇到了同样的错误。我尝试了一切(重新安装 pod,更新所有 gems 等),我发现解决方案对我的情况有效。由于更改目标名称而出现问题。在这种情况下,解决方案很简单:
- Click Product -> Scheme -> Manage Schemes...
- Click on your target on the list and delete it with "-" sign on bottom of window.
- Click "+" to add target back to list. Choose correct target and name.
- 点击产品 -> 方案 -> 管理方案...
- 单击列表中的目标并在窗口底部使用“-”号将其删除。
- 单击“+”将目标添加回列表。选择正确的目标和名称。
After all everything should works.
毕竟一切都应该有效。
回答by Joseph Lord
- Add the relevent xcconfig files to your project. Cocoapods will have created them but you can't set them in Xcode until they are in the project.
- You probably want to add them to the Pods group where the other pods xcconfig files are. Right click and add files.
- Search for xcconfig files in your project folder or look in
Pods/Target Support Files/[TARGET_NAME]/
(I have different cocoapods configured for each target (extension and main project this may be slightly different in your case)
- Go to project configurations in the Info of your main project
- For each target and configuration set the appropriate pods configuration.
pod install
again and you should see no errors.
- 将相关的 xcconfig 文件添加到您的项目中。Cocoapods 会创建它们,但在它们进入项目之前,您无法在 Xcode 中设置它们。
- 您可能希望将它们添加到其他 pods xcconfig 文件所在的 Pods 组。右键单击并添加文件。
- 在您的项目文件夹中搜索 xcconfig 文件或查看
Pods/Target Support Files/[TARGET_NAME]/
(我为每个目标配置了不同的 cocoapods(扩展和主项目,这在您的情况下可能略有不同)
- 转到主项目信息中的项目配置
- 为每个目标和配置设置适当的 pods 配置。
pod install
再次,您应该看不到任何错误。