How to install pod? It's not getting installed in my application - ios

How to do pod installation? I tried it out but nothing is happening in my swift application.
pod requires active gem version 2.2.2

First of all, gems are ruby script. To install it go to your terminal and type then you would need to provide your password.
sudo gem install cocoapods
after it was installed to your xcode project where you want to add or use the pod , and make sure the xcode project is closed.
so if I wanted to go my project in the desktop in the terminal
cd Desktop && cd name_of_project
Then now type:
pod init
then you open the pod file
open Podfile (it will open inside of a text editor)
now remove the # in front of platform :ios, '8.0' and use_frameworks
In between the
target "name_of project" do
// place the source and the pod
end
save the file then go back to the same terminal and type:
pod install
wait until it finished then go your xcode (not to your terminal) project then open .xcworkspace everytime you want to access your project

You need CocoaPods to be installed in your system.
Go to Console,
and type:
sudo gem install cocoapods --verbose
If you get any warning(s)/error(s) then, please update the question with the log showing ther warning(s)/error(s).
Kind Regards,
Suman Adhikari

For me I down graded the pod to an earlier version and then it worked perfectly well.

Related

Add cocoapods to existing project

I know this have been asked multiple times, but I still couldn't find the right answer.
I have a project (React Native) that already has a lot of code, lots of dependencies, xcode tweaks, etc. Far away from a vanilla project.
I want to add cocoa pods to it because some third party library can only be installed with it. However, I can't find anywhere information about if I need to "migrate" all my third party packages as well to cocoa pods (move all the linked dependencies there), or is it enough to create a fresh pod file with just those two new dependencies, and everything else should work just fine.
Install CocoaPods on System
Step.1 Open Terminal and enter the following command:
sudo gem install cocoapods
Create Podfile for Project
Step.2 now you need to close Xcode.
Open Terminal at project's root folder
Step.3 Next, enter below command to create podfile:
pod init
Edit podfile
Note: Make sure we will edit podfile with Xcode not TextEdit etc.
Step.4 Type this command to open the Podfile using Xcode for editing:
open -a Xcode Podfile
Step.5 update pode file what you want.
for example
pod 'SwiftForms'
when you add this line it wii installing at next step :)
let's go for install
Step.5 Enter the following command in Terminal and hit Enter
pod install
Thats it!! we have done.
Open Project with pods
Now go to the project folder,we can see that CocoaPods created a new project_name.xcworkspace file and a Pods folder.
open project_name.xcworkspace with xcode
This article has the answer I needed in a very similar situation: https://medium.com/#soufianerafik/how-to-add-pods-to-an-xcode-project-2994aa2abbf1
Essentially this:
install Cocoapods, if needed
terminal to your project root
pod init
pod install

How to solve "error running pod install" in flutter on mac?

I have an error when I tried to launch my project on my iPhone, the basic Flutter example is working on my iPhone but when I use my project I have this error.
In Flutter project, I Also faced with this issue. Fixed by updating flutter and cocoa pods to the latest version.
Solution:-
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get
cd ios
pod install
arch -x86_64 pod install //(On an M1 mac use => arch -x86_64 pod install)
cd ..
flutter build ios
flutter run
You can fix it with
sudo arch -x86_64 gem install ffi
I got this error when I was using Firebase in flutter, the solution for me was to set the Podfile deployment target to a iOS version higher than 9.
Example:
Changed this
#platform :ios, '9.0'
to
platform :ios, '13.0'
And as #Mana commented, remember the higher the version you set, your app will not be supported for users with lower IOS versions
I faced the same issue and none of the above work. Finally I resolved it by:
Check ios/.symlinks/plugins contains extra plugin which you are not using.
Delete podfile.lock in ios folder, if it exists.
Delete podfile from ios folder.
Delete pods folder in ios directory.
Run flutter clean in the terminal.
Run flutter pub get in the terminal.
Run flutter runin the terminal.
2022 update
After struggling for hours the following helped me:
sudo gem uninstall cocoapods
brew install cocoapods
Make sure you have HomeBrew installed before you do the above. Steps to install HomeBrew: Install HomeBrew
For Mac M1, try the following commands. Worked for me fine
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
Change directory to your project; e.g /dart/apps/abc
Type, flutter clean && pod update
So did you solve this problem?
I met the same situation. And this is the solution I found.
Link
Basically:
Locate Terminal.app in Finder. (Applications->Terminal.app)
Right-click and choose Get Info
Check the “Open using Rosetta”
Quit all instances of Terminal app and run it again
Run sudo gem install ffi
After you finish the above several steps, restart your IDE and re-run the application.
Please give a reply if this method works.
I'm using VS Code and flutter 2.10.1
running intel mac
I've faced this problem several times, usually when switching between projects or when working with multiple versions of project. But the solution is pretty simple.
Inside your project parent directory go to, ios -> Podfile. Here the top line will be something like this,
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
check whatever version you are using on simulator and replace '9.0' with that and uncomment.
# Uncomment this line to define a global platform for your project
platform :ios, '15.4'
Now if we try to run the flutter project, the debugger will say that the cocoapods are outdated. So just update them using command
pod repo update
And that should solve the problem.
Simply delete the Podfile from your project
Run this command in terminal (I did in Android studio terminal it self)
sudo gem install cocoapods
And then run this
pod init
It works for me..
The link https://cdn.cocoapods.org does not work correctly, I had to change the source in ios/Podfile as described in the code below:
Change source in ios/Podfile
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
Clean your project
flutter clean
Install referenced packages
flutter pub get
Run the app
The error can also come from a package which requires a version higher than '9.0' in this case it is necessary to uncomment the line # platform :ios, '9.0' and to pass for example to version '14.0' according to the version requested by the package.
Delete the podfile.lock (located in app root > ios folder)
Run in Terminal pod install --repo-update
flutter run
There are multiple reasons this could occur so a one-size-fits-all solution won't exist.
Instead, in terminal, run:
$cd ios
$pod install
This will give you more in depth information on the error and you can search from there. In my case one of my dependencies required a higher minimum ios version so I had to open the .xcworkspace file and adjust the minimum deployment version in xcode>targets>general>minimum_deployments
For me none of the above helped, the following worked on my case:
Deleted the macos folder from main project.
Created a dummy flutter project.
Copied the newly created macos folder.
Pasted it to my main project.
Additionally I use firebase plugins, so I made some changes in pod file,..
It started running.
I'd the same problem, in my case when I ran pod install --verbose I realize that there was an specific error during pod install
undefined method `each_child' for #Dir:0x00007ff10befa7f0 Did you mean? each_slice
Looking for this specific error I found this answer and I realize that I was using ruby 2.5 and one file generated by Flutter for iOS devices was trying to use a method that was introduced on version 2.6.
After follow the steps on that answer I could run my Flutter app on iOS simulator.
The method dir.each_child was introduced in Ruby 2.6, but you are using Ruby 2.3.0.
You should update Ruby to 2.6.0 or later 2.x version.
After Ruby updating you may also need to restart your IDE and re-install cocoapods.
Check in ios/.symlinks/plugins for unused plugins. and if there are, remove from pubspec.yml. This solved my problem.
As per the install instructions make sure M1 users run. Solved the issue for me. I missed it on install!
$ sudo softwareupdate --install-rosetta --agree-to-license
run this code on the terminal
sudo arch -x86_64 gem install ffi
Next, go to the ios folder in your project, and open Podfile.
Then change #platform :ios, '9.0' to platform :ios, '10.0'
I solve the same issue so:
Delete podfile.lock in iOS-folder app
Run pod repo update in the terminal
Re-compile my code
I had similar problems running flutter web on mac.
Make sure you uncomment and update the podfile from macos folder not ios
I'm talking about these lines:
# Uncomment this line to define a global platform for your project
platform :osx, '15.4'
If you want an automated script to change the deployment target, use
sed -i '' 's/9.0/10.0/' ./.ios/Podfile
where 9.0 is the generated iOS version and 10.0 the desired
on your pipeline, shell script or whatever
If anyone is struggling on M1 machines with a particular pod, the following helped me:
flutter precache --ios
arch -x86_64 pod update Firebase/Firestore //or name of pod from the error
Open Your Terminal paste this line of code open ~/.zshrc press Enter
if you don't have the zshrc file you will have to create it, to create it you need to open terminal paste this code touch ~/.zshrc add you flutter path and move to Second instruction
2 The Text File will open add then you add this export LANG=en_US.UTF-8

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/

Cannot Install Cocoapods - No podfile found in the project directory

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

How cocoapods works with xcode 6 on OSX 10.9.3?

please help me on this. I've updated my xcode to xcode6 and now I'm not able to run my application on it due to cocoapods errors. I searched around the web also follow the below steps :
Open Xcode 6
Open Preferences (Menú Xcode-Preferences)
Click the Locations tab
Change the Command Line Tools version to Xcode 6.0
Uninstall from a terminal window cocoapods (all installed versions prompted)
$ sudo gem uninstall cocoapods
Uninstall xcodeproj (all installed versions prompted)
$ sudo gem uninstall xcodeproj
Install xcodeproj
$ sudo gem install xcodeproj
Install cocoapods (retry a second time if fails with a error)
$ sudo gem install cocoapods
Run pod –version to verify that it worked
But Still I'm getting error on pods. My application is running well in xcode 5.1.1 but not in xcode 6. I'm getting error on "SDWebImageDownloaderOperation.m" file and the error is semantic issue.
One more thing when I'm doing pod update in my project folder where the podfile installed, Removing SSToolkit shown and SSToolkit folder removed from project folder. But in xcode 5.1.1 SSToolkit is there.
please someone help me to rid of this issue....
thanx
Your problem is with SDWebImage, not with cocoapods. because of the presence of the getter attribute on the executing and finished properties, the newer version of XCode is not auto-synthesizing the variables.
There should be a compatible version RSN, but to work around it for the time being, you should change your podfile for the package to add the version:
pod 'SDWebImage', :head
Once it gets released you can remove the reference to :head
Note this is a real 'short time window' question - This package will probably start working again in a few days without intervention from anyone barring a pod update.
This is the problem with the SDWebImage.
Just replace _executing with self.executing.
And clean your code and build it again.
Thanks
Sarabjit Singh

Resources