I downloaded a sample project to learn how to make a UIPageViewController, and I am trying to essentially fork that project and need to add a third-party library. Right now, it does not look like I have a .xcworkspace file in my project. When I try and install the cocoapods, I first run
sudo gem install cocoapods
- in the specific project directory in my terminal
pod install
- in that same directory
I am receiving an error in the terminal "No podfile found in the project directory."
Is this happening because I don't have a .xcworkspace file? Am I installing the podfile correctly?
Right click on that and choose Open With option in that you can open your Podfile in TextEditor or TextWrangler. If you have the CocoaPods app installed: open Podfile -a CocoaPods from the Podfile directory in Terminal will open the Podfile for editing in the app.
sudo gem install cocoapods
-> This installs CocoaPods as a piece of software on your machine.
Go to the root of your project directory and execute pod init
-> This will add a base Podfile to your project.
Add the external dependencies that you have to this Podfile by editing it.
Run pod install
which will fetch all the external dependencies mentioned by you, and associate it with a .xcworkspace
file of your project. This .xcworkspace
file will be generated for you if you already do not have one.
From here on, you should use .xcworkspace
file instead of .xcproject
/ .xcodeproj
.
target 'MyApp' do pod 'AFNetworking', '~> 3.0' end
Where AFNetworking
is the pod and 3.0
is the specific version that I want to install.
Documentation: Using CocoaPods
If you want to add a library from GitHub to your own project, after installing gems, do firstly pod init
look at from GitHub cocoapod description and then add it after target line in podfile.
Save and run "pod install".
It would be successfully added on your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With