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

时间:2023-01-27 10:44:30

I do have an existing project of Xcode (swift 3) in which a detailed UI has been designed. I am still unable to install CocoaPods into that project. All the guides I've seen on how to install cocoaPods people CREATE A NEW PROJECT and install it in that NEW PROJECT however I want to install it in an existing (designed UI) project. Trying to install cocoaPods in that project lead me to a workspace that shows everything empty and red lines everywhere on the left see the screenshot and suggest a solution please. Thanks! Screenshot of workspace

我确实有一个Xcode(swift 3)的现有项目,其中设计了详细的UI。我仍然无法将CocoaPods安装到该项目中。我见过的关于如何安装cocoaPods人员的所有指南创建一个新项目并将其安装在新项目中然而我想在现有(设计的UI)项目中安装它。试图在该项目中安装cocoaPods引导我进入一个工作区,显示左边的所有空白和红线,请看截图并提出解决方案。谢谢!工作区截图

1 个解决方案

#1


1  

Please follow the below steps for installing pods to an existing project:

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

Open Terminal and navigate to the directory that contains your project by using the cd command: cd ~/Path/To/Folder/Containing/Project

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

Next, enter the following command:

接下来,输入以下命令:

pod init

pod init

This creates a Podfile for your project. Finally, type the following command to open the Podfile using Xcode for editing:

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

open -e podfile

打开-e podfile

It opens the podfile for you.

它会为您打开podfile。

Now edit podfile to add required frameworks. it should look similar to below snippet.

现在编辑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

Then after pods will be integrated to the project and .xcworkspace will be created.

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

Next time open the .xcworkspace to continue with the project.

下次打开.xcworkspace继续项目。

#1


1  

Please follow the below steps for installing pods to an existing project:

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

Open Terminal and navigate to the directory that contains your project by using the cd command: cd ~/Path/To/Folder/Containing/Project

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

Next, enter the following command:

接下来,输入以下命令:

pod init

pod init

This creates a Podfile for your project. Finally, type the following command to open the Podfile using Xcode for editing:

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

open -e podfile

打开-e podfile

It opens the podfile for you.

它会为您打开podfile。

Now edit podfile to add required frameworks. it should look similar to below snippet.

现在编辑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

Then after pods will be integrated to the project and .xcworkspace will be created.

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

Next time open the .xcworkspace to continue with the project.

下次打开.xcworkspace继续项目。