gpt4 book ai didi

ios - 无法在现有的 Xcode 项目中安装 cocoaPods

转载 作者:行者123 更新时间:2023-11-28 15:21:09 24 4
gpt4 key购买 nike

我在 Xcode (swift 3) 中有一个现有项目,其中设计了详细的 UI。我仍然无法将 CocoaPods 安装到该项目中。

我看到的关于如何安装 cocoa pod 的所有指南人们创建一个新项目并将其安装在该新项目中,但是,我想将其安装在现有(设计的 UI)项目中。尝试在该项目中安装 cocoa pods 将我带到一个工作区,该工作区显示左侧各处的所有内容都是空的和红线,请查看屏幕截图并提出解决方案。谢谢!

Screenshot of workspace

最佳答案

请按照以下步骤将 pod 安装到现有项目:

打开终端并使用 cd 命令导航到包含您的项目的目录:cd ~/Path/To/Folder/Containing/Project

接下来,输入以下命令:

荚初始化

这会为您的项目创建一个 Podfile。最后,键入以下命令以使用 Xcode 打开 Podfile 进行编辑:

打开-e pod文件

它会为您打开 podfile。

现在编辑 podfile 以添加所需的框架。它应该类似于下面的代码片段。

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectTarget' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Messaging'
# Pods for ProjectTarget
target 'ProjectTarget-iOSSDKTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectTarget-iOSSDKUITests' do
inherit! :search_paths
# Pods for testing
end
end

然后将 pod 集成到项目中并创建 .xcworkspace。

下次打开 .xcworkspace 以继续该项目。

关于ios - 无法在现有的 Xcode 项目中安装 cocoaPods,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45975406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com