Using Cocoapods in Xcode 7.3

I installed Cocoapods using a terminal and everything went well, but I can’t figure out how to integrate it into my Xcode project. I change the directory to the main folder containing the Xcode project, and type $ pod init , which creates the original subfile in the Xcode project folder. Then I open the Podfile in Xcode and make it as follows:

 platform :ios, '9.0' use_frameworks! target 'MyApp' do pod "ForecastIO" end 

Then I go back to the terminal and type $ pod install , and everything goes well. The problem is that none of the files appear in the project directory inside Xcode, but they are in the Finder folder containing all the project files. I tried to drag new files into the project directory manually, but some of them still do not appear, and the syntax of the subfile code is not highlighted. Also does not allow me to import the cocoapod, which he allegedly just installed. I'm new to all of this, and I probably missed something simple, but I can't figure it out. Any help is appreciated.

Tl; dr How to implement ForecastIO Cocoapod in an Xcode project?

Lint to ForecastIO Pod Info: https://cocoapods.org/pods/ForecastIO

+1
source share
3 answers

Your opening YourProjectHere.xcodeproj when you need to open the YourProjectHere.xcworkspace folder

  • Create a new project in Xcode

  • Go to your terminal and run this command from the same folder where your YourProjectHere.xcodeproj object is located in

     $ pod init 
  • Edit your subfile
  • Run this command from the same folder where your YourProjectHere.xcodeproj object is located in

     $ pod install 
  • A workspace should now be created. Run this command from the same folder where your YourProjectHere.xcodeproj object is located in

     $ open YourProjectHere.xcworkspace/ 
+3
source

When you integrate the pod and the subsequent podfile for use with your project, it works with your application, rather than being built into it anymore. So you have to use the workspace file (white, not blue) from here. This is a higher reach file since it includes both your project and the pods directory as a project.

The common practice is to close the application anyway while performing the pod installation and reopen the workspace. Some people have problems importing the container immediately, so I will also first create with the package installed and then build again using the import statement.

0
source

I know that it is too late to answer, but so far I do not see a confirmed answer to this question. In my case, I have two versions of Xcode: 7.3.1 and 8.2.1 (for some reason, I have to support it, since my code is in Swift 2.3, and I use several libraries). Therefore, when I tried to run pod install, the pods loaded, and I could see them in the Finder, but the command did not create the WorkSpace file. I googled and landed on this question, but I did not find anything here that helped me solve the problem.

  • Well, I found the solution myself ..
    • In Xcode, choose Preferences> Locations
    • Choose the appropriate version of Xcode in the command line tools
    • Run pod installation command in terminal

Voila, the workspace file is created! :)

I hope this helps someone who has the same problem. Greetings.

enter image description here

0
source

Source: https://habr.com/ru/post/987841/


All Articles