2017-08-31 88 views
0

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

+1

看看这里的指令:https://stackoverflow.com/questions/36084956/integarte-install-cocoapods-to-existing-xcode-project-objective-c-or-swift – Oleshko

+0

似乎,你的项目路径更改。由于某些文件丢失。 – iDeveloper

+0

@Mumtaz重新打开您的项目 –

回答

1

请按照安装荚现有项目下面的步骤:

打开终端并导航到使用cd命令包含项目的目录: CD〜/路径/要/文件夹/含/项目

接下来,输入以下命令:

荚初始化

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

开放-e podfile

它打开了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继续该项目。

+0

[This](https://stackoverflow.com/questions/20755044/how-to-install-cocoa-pods)有更好的选择! –

+0

感谢@ user3515245和Anurag我现在已经成功地在您的帮助下安装了pod。 –

相关问题