0

I do have an existing project in 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 cocoa pods 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 cocoa pods 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

iDeveloper
  • 2,339
  • 2
  • 24
  • 38
Mumtaz Hussain
  • 925
  • 9
  • 23
  • 1
    Take a look on instruction here: https://stackoverflow.com/questions/36084956/integarte-install-cocoapods-to-existing-xcode-project-objective-c-or-swift – Oleshko Aug 31 '17 at 07:21
  • Seems like, your project path change. Because some files are missing. – iDeveloper Aug 31 '17 at 07:24
  • @Mumtaz Reopen your project – Anurag Sharma Aug 31 '17 at 07:34
  • Thanks Oleshko I already followed that, it doesn't even create a workspace. – Mumtaz Hussain Aug 31 '17 at 07:34
  • @Mumtaz What error did you get while installing cocoa pods? Considering your screenshot, It seems like your project path has changed and you are accessing the previous path and trying to install cocoa pods in the previous path. Update your path then try to install cocoa pods again!! – Anurag Sharma Aug 31 '17 at 07:37

1 Answers1

1

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

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

Next, enter the following command:

pod init

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

open -e podfile

It opens the podfile for you.

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

# 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.

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