[英]How to expose your project code to a Xcode playground when using cocoapods?
[英]Cocoapods Warning - CocoaPods did not set the base configuration of your project because because your project already has a custom config set
在我的项目基础上执行pod install
后,出现以下错误:
CocoaPods 没有设置项目的基本配置,因为你的项目已经有一个自定义配置集。 为了使 CocoaPods 集成正常工作,请将目标
BluePlaquesLondonFramework
的基本配置设置为Pods/Target Support Files/Pods/Pods.debug.xcconfig
或包含Pods/Target Support Files/Pods/Pods.debug.xcconfig
在您的构建配置中。
这听起来可能是个愚蠢的问题,但我该如何为目标设置基本配置呢?
https://github.com/seanoshea/BluePlaquesLondon/blob/ios8/Podfile是导致此问题的 Podfile。
http://github.com/seanoshea/BluePlaquesLondon在 iOS 8 分支上是有问题的 Podfile,如果您想看看项目是什么样子的话。
我遇到了同样的问题,但在 Xcode 6.1.1 中 - 对我来说修复它的是将两个与 Pods 相关的目标的配置文件设置更改为None
,然后再次运行pod install
。
通过选择项目(而不是目标),然后选择信息选项卡,可以找到配置文件设置。
进入 XCode 并打开您的项目设置,在“信息”选项卡下,您将看到“配置”,您可以在其中为调试和发布设置配置文件。 您显然已经将这些设置为一些自定义配置,而 CocoaPods 想要/需要您使用 Pods 配置。
遇到了同样的问题。 它会建立在模拟器上,但不会建立在我的设备上。 没有一个答案为我解决了这个问题。 以下是我拼凑的一些答案:
更改了我的 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.
[!] 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.
您还应该确保Podfile
的根目录中没有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
您可能还需要从目标依赖项中删除libPods.a
和libPods-app.a
,执行清理,然后再次运行pod install
。
在添加了一些自定义构建配置后,我刚刚遇到了这个问题。 我可以在下面看到:
Pods (target) > Target Support Files > Pods
它实际上创建了与新构建配置匹配的新xcconfig
文件,但由于某种原因,我无法在我的应用程序的项目目标中选择这些文件。
对我来说修复它的是安装和使用cocoapods-deintegrate :
gem install cocoapods-deintegrate
然后运行:
pod deintegrate
其次是:
pod install
podfile 中产生问题的行是:link_with ['BluePlaquesLondon', 'BluePlaquesLondonFramework']。
只需这样做: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
如果您在现有项目中添加了自定义构建配置,Cocoapods 会抱怨它。
Cocoapods 将按照命名模式Pods-<build_target>.<build_config>.xcconfig
在目录Pods/Target Support Files/<build_target>
下自动创建 xcconfig 文件。
只需确保将这些文件手动添加到 Xcode 中的项目中(在 Pods 目录下,但不在 Pods 项目中!)。 包含这些文件后,在 Xcode 中选择您的项目,转到“信息”选项卡,然后展开您的自定义配置。 为自定义配置下的每个目标选择适当的 xcconfig 文件。
如果您使用自定义配置,您可以按照警告中的建议并将 Pod 配置包含在您的配置文件中
#include "Pods/Target Support Files/Pods-YYY/Pods-YYYY.develop-archive.xcconfig"
这不会停止警告,但将允许您使用您的私人配置(CocoaPods 项目的警告有一个开放的错误) https://github.com/CocoaPods/CocoaPods/issues/2633
我在安装 pod 时遇到了同样的错误。 我尝试了一切(重新安装 pod,更新所有 gems 等),我发现解决方案对我的情况有效。 由于更改目标名称而出现问题。 在这种情况下,解决方案很简单:
毕竟一切都应该有效。
Pods/Target Support Files/[TARGET_NAME]/
(我为每个目标配置了不同的 cocoapods(扩展和主项目,这在您的情况下可能略有不同)pod install
,您应该看不到任何错误。我将 Podfile 中的 Pod 从目标移到了外面。 文件从此更改:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'MyProject' do
pod 'Firebase', '>= 2.5.0'
pod 'Onboard'
pod 'GoogleMaps'
pod 'IQDropDownTextField'
end
对此:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Firebase', '>= 2.5.0'
pod 'Onboard'
pod 'GoogleMaps'
pod 'IQDropDownTextField'
target 'MyProject' do
end
对于那些来自 Flutter 世界的人来说,这是一条误导性的错误消息,暗示了不必要的操作,正确的做法是忽略错误并使用flutter
cli(不是pod
),如Z5E056C500A1C4B6A7110B50D807中所述。 /flutter/issues/73845 :
gatzsche 说更好的信息是:
在 Flutter 中,不应手动调用 pod install。 要运行 pod install 执行以下命令
flutter clean
、flutter pub get
和flutter build ios
。
jmagman 笔记:
正如您所指出的,错误消息暗示了不必要的操作。 flutter 命令抑制来自 pod 的消息。 您直接运行 pod,这不是推荐的工作流程。 我们无法控制来自 CocoaPods 的错误消息,并且 flutter 命令行工具已经抑制了令人困惑的消息。
所以对我来说,问题是由于上述 xcconfig 文件名在 Swift 3 更新发生之前被更改了。
有些东西不同步,所以 Cocoapods 用旧命名的文件创建了一个“恢复的引用”文件夹部分,并链接到它们。
为了解决这个问题,我:
退出 Xcode
运行 pod 安装
在那之后,一切都为我处理了,警告消失了。
仔细阅读错误消息后,我解决了我的问题:
[!] CocoaPods 没有设置你的项目的基本配置,因为你的项目已经有一个自定义的配置集。 为了让 CocoaPods 集成工作,请将目标
Runner
的基本配置设置为Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig
或包含Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig
在你的构建配置中(Flutter/Release.xcconfig
)。
解决方案
打开 Xcode 并将 Runner Info Base Configurations 更改为相关的 Pods-Runner.profile.xconfig。
退出 Xcode
终端:从 ios 项目文件夹运行pod deintegrate
验证 Pod 是否已移除
Project has been deintegrated. No traces of CocoaPods left in project. Note: The workspace referencing the Pods project still remains.
终端:从 ios 项目文件夹运行pod install
(来自这个原件 - 坏)
(到这个GOOD设置)
笔记
我无法使用错误消息中提到的将 xconfig 文件包含在
Flutter/Release.xcconfig
配置文件中的第二个建议来解决问题。
我能够通过以下方式在 XCode 6 上构建受此问题影响的项目:
希望这会帮助某人。
这发生在我身上,因为我已经有了一个 Pod 配置。 我是 iOS 开发的新手,正在搜索安装 Alamofire + SwiftyJSON 的说明,结果无意中不止一次安装了这些库。 对我来说,有效的是:在“Pods”项目中的“Target Support Files”文件夹中,我选择了两个正确的 .xcconfig 文件并将它们拖到我的应用程序项目的“Pods”文件夹中。 这使得能够在基本配置上选择正确的配置文件。
但是,如果我再次运行“pod install”,警告将更改为之前的 .xcconfig 文件。 我尝试从主项目中删除文件和旧框架,但是当我再次运行上一个命令时,给了我同样的警告,并在我的应用程序项目的“Pods”文件夹下创建了文件“Pods.framework”。 我忽略了它,尽管有两个框架,但它似乎运行正常。 我不知道它是否正确,如果存在解决方案,将受到欢迎。
我有错误:
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.
我刚刚检查了我安装 pod 的路径并更正并再次安装,它刚刚工作。
确保在 .xcodeproj 或 .xcworkspace(如果它已经存在)存在之前给出路径。
只需按照 Android Studio 说明操作即可。 这是错误输出:
"[!] 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 `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`)."
在 android studio IDE 中转到 IOS 文件夹/Flutter 并打开文件 Release.xconfig
然后刚过这一行:
Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig
删除 podfile.lock 并尝试在 Xcode 中重建。 为我工作。
在此页面https://firebase.flutter.dev/docs/firestore/overview/ 上有第 4 步。(可选)改进 iOS 和 macOS 构建时间。 不知道如何,但添加那条线对我来说很神奇......
似乎是一个很好的 ole 系统重启,而且可能更重要的是,我似乎不得不重新安装 cocoa pod,即使 CLI 似乎处于完美的工作状态并且在今天之前已经工作了很多天。
sudo gem install cocoapods
这似乎不是其他任何人的解决方法,但我认为我应该发布它,因为这让我发疯了,希望它至少能帮助另一个人。
这是我在运行 pod install 或 pod update 后收到的消息:
[!] 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 `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig` in your build configuration (`Flutter/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 `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.release-staging.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.release-staging.xcconfig` in your build configuration (`Flutter/Release.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 `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile-staging.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile-staging.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
这就是我为解决问题所做的工作:
将方案添加到项目“Runner”下的 Podfile
project 'Runner', {
'Debug' => :debug,
'Debug-staging' => :debug,
'Profile' => :release,
'Profile-staging' => :release,
'Release' => :release,
'Release-staging' => :release,
}
Go 到 ios/Flutter/Debug.xcconfig 并包含
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig"
Go 到 ios/Flutter/Release.xcconfig 并包含
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release-staging.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile-staging.xcconfig"
最简单的解决方案(多次遇到此问题后):
这将重新创建所有内容并始终在几分钟内工作(而不是花时间对“错误”进行逆向工程)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.