Cannot Install Cocoapods - No podfile found in the project directory - ios

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?

Steps to add CocoaPods to manage dependencies in your project:
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.
Example Podfile Syntax:
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

Just posting for anyone that encountered this issue while working on a react native project.
sudo gem install cocoapods
this installs cocoa pods to your machine
cd projectDirectory cd into your project directory
cd ios cd into the ios directory of your project, is you list items that are in this folder, you would most likely see a podfile there.
pod install

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.

Don't forget to call pod install in the Project folder of your project (not in the root).

Open a terminal, if you use VSCode, you can just run the following from the terminal
Do a cd <project_name> to your flutter project directory
Run cd iOS
Then run pod install

Related

do i need to install alamofire in code if share the code to other system

I have installed alamofire using PODS on my macbook in my current project.
Now if i share same project to some other person, do he/she also need to install alamofire to run the project ?
Thanks
Yes, They have to install pods. If the other user don't have cocoapods. They have to install cocoapods first.
1.First open your terminal
2.Then update your gem file with command
sudo gem install -n /usr/local/bin cocoapods
3.Then give your project path
cd /Path of project
pod install
How are you going to share the project with the other person?
If you're using git the common approach is to have Pods/ directory declared in .gitignore file. In such case the person needs to run pod install after fetching the project. This requires Podfile and Podfile.lock files to make sure that you both work on the same version of the library.
If you simply copy-paste the directory then it's not required at all, as all the files (including workspace and pods) are already attached.
Yes, they will have to install alamofire.
They will have to navigate to the project's root directory and then in their terminal run the following command pod install

Issue with CocoaPods

hi Iam new to iOS and i am trying to use CVCalender for custom calendar https://github.com/CVCalendar/CVCalendar#-cocoapods-
and i am try to install the cocoa pods but its getting error,
But i have muly cocopods in my file is these are use full or i need to delete these things as shown in image
can any one help me to how to install coacoa pods sucessfully and install cvcalender
after adding delegates also showing same error
1.Open terminal
sudo gem install cocoapods
2.Setup the cocoapods master repo
pod setup
download the master repo. The size is big approx 370.0MB
3.Create xcode project and select root directory in terminal.
cd "your XCode project root directory"
4.Then type
pod init
5.Then open your project's podfile by typing in terminal
open -a Xcode Podfile
6.Add your project's dependencies in open text podfile.
**for ex.** pod 'CVCalendar', '~> 1.5.2'
7.Then install pods into your project by typing in terminal
pod install
Now close your xcode project and open .xcworkspace xcode project file.
Happy Coding.
Also refer cocoapods link. https://cocoapods.org/

Cocoa Pod Setup for existing xcode project

I found these tutorials to create our own cocoapod:
https://guides.cocoapods.org/making/making-a-cocoapod.html
http://code.tutsplus.com/tutorials/creating-your-first-cocoapod--cms-24332
but for me none of them helps, as they create fresh xcode project using pod lib create. I have my own xcode project and I need to setup in that rather than create a fresh one.
1.Delete following files/folder that pod created.
2.Make sure your Podfile available.
3.Use this command:
pod install
Updated
If you didn't have installed pod in your project. Do like following:
1.Use pod setup in your project root folder.
2.Edit Podfile
3.Use this command:
pod install
Try to do like this:
1.Run the command on Terminal:- sudo gem install cocoapods
After successfully install CocoaPods
2.Go to that folder where your existing project is saved in your System.
3.After that Run the command for creating Pod file:- Touch podfile
4.After Creating Pod file run the next command:- Open podfile
It will open pod file and here Put the below line and save that file using command+S
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘8.0’
use_frameworks!
pod 'Alamofire', '~> 2.0.2’
5.After that run the final command in your Terminal:- pod install
It will take some time to install that file after that once install the all file close the xcode project and again open that project, click on the .xcworkspace extension file.

I just installed CocoaPods and when i run my iOS application it fails to read the imported header files

So I added for example, #import "test/test.h" and when I do command click on it, it goes the the .h file so I think it reads it. yet when I build it says cannot find .h file.
I've uninstalled pods from my project and reintegrated pods few times now and still the same issue.
Ive tried doing a clean as well.
I notice that under Frameworks in my app, Pods_App.framwork is red if that means its missing or its normal?
Try this
#import <test/test.h>
"test/test.h" will search the file in the current source directory whereas <test/test.h> searches in the header search paths
Quite Xcode and open your .xcworkspace again and try to import like this:
#import <test.h>
Try this one.
CocoaPods
Install CocoaPods if not already available:
$ [sudo] gem install cocoapods
$ pod setup
Change to the directory of your Xcode project:
$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
Edit your Podfile and add [COCOA pod FILE name]:
platform :ios, '6.0'
pod 'FILE NAME'
Install into your Xcode project:
$ pod install
Open your project in Xcode from the .xcworkspace file (not the usual project file)
if you Already install cocoa pod file, Then only open Below file:
$ open MyProject.xcworkspace

How to remove library installed with CocoaPods?

I'm trying to fully remove a library I installed using CocoaPods.
I've removed the entry from my Podfile and called pod install from the terminal.
All the library files seems to be deleted but I can still do import myLibrary in my iOS Swift project without any build errors.
Why is this so?
In order to completely remove the imports from a previously built project try to clean it first:
In Xcode:
⇧⌘K ( or Product > Clean )
This should clear the compiled code from within the projects release or debug directory:
/Library/Developer/Xcode/DerivedData/<Project>/Build/(Release or Debug)
The compiler will often try to use code that it's already compiled during the build process if it can.
Try Cleaning your project.
or use deintegrate
$ gem install cocoapods-deintegrate
$ gem install cocoapods-clean
in your project folder
$ pod deintegrate
$ pod clean
Modify your pod file (delete what you don't want to use anymore)
$ pod deintegrate

Resources