Integarte/Install cocoapods to existing xcode project, objective-c or swift - ios

I was looking for integrating cocoapods to my existing xcode projects.
I found these few post but they are based on issue instead my problem.
not able to acess installed pods framework
How to add cocoapods to existing workspace not project (this one is for work-space not project)
Making a CocoaPod from an existing Xcode project (this one is more on integrating swift with objective c project)
So I spending quality time i did for my project.
I am sharing step by step integration in my answer post.
please feel free to suggest and improvement.
happy to learn and share

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 as shown below screenshot, save and close.
Install lib/framework
Now we have added our required lib/framework pod command
pod 'SwiftForms'
let's go for install
Step.5 Enter the following command in Terminal and hit Enter
pod install
Result screen
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
your project structure should look like

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

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/

How to get ios OneDrive framework

i want to apply OneDrive SDK in my app.
https://github.com/onedrive/onedrive-sdk-ios
this site has only one way using cocoapod. but i want to apply .framework file(not use cocoapod).
how to get OneDrive.framework file.
#Dylan S
thank you your description, but i have error.
here is my process.
download OneDrive source
in OneDriveSDK folder : pod install
and result
open OneDriveSDK.xcworkspace file and build
get OneDriveSDK.framework
add this framework in my project and buld.
but i have linking error.
my test code:
#import <OneDriveSDK/OneDriveSDK.h>
[ODClient clientWithCompletion:^(ODClient *client, NSError *error){
if (!error){
// self.odClient = client;
}
}];
linking error :
is it right my process?
You can build your own copy of the framework, without installing it as a Cocoapod but you will still need to use Cocoapods when building. OneDriveSDK uses Cocoapods.
Anyway, start by downloading the code (at master or whatever release you want). It's up on GitHub, so pop on over there. I'll wait.
Next up - install its Cocoapod dependencies so Xcode will be able to build the code. If you don't have Cocoapods installed, you'll need to install the gem with sudo gem install cocoapods. Checkout their guide for more info.
You install the pods to the project with pod install from within the OndeDriveSDK directory - it's the one with the file named Podfile.
Now you're ready to build: open "OneDriveSDK.xcworkspace" (notice xcworkspace and not xcodeproj).
Pick the "OneDriveSDK" scheme and build for "Generic iOS Device". Reference the above screenshot.
Finally, build it. Product -> Build For -> Running. It should just work, it did for me.
Once Xcode finishes, open the "Products" folder. Find "OneDriveSDK.framework" and right-click selected "Show in finder". There's a screenshot below of what to look for. Grab the framework file and you're ready to go. Drop it into your project.
UPDATE:
sample code: https://github.com/soheilbm/StackOverFlowQ1
Install cococapod and Rome plugin
gem install cocoapods
gem install cocoapods-rome
Create a empty project (Testing) and setup podfile with:
platform :ios, '8.0'
use_frameworks!
target 'Testing' do
plugin 'cocoapods-rome'
pod 'OneDriveSDK'
end
Run:
pod install
Go to Rome directory and copy all frameworks (except Pods_Testing.framework)

Cocoapods error for one project target while others are working fine

I have create 3 project target (Development, Production and Staging).Expect Production other working fine after pull the changes of others while building the production target xcode giving the error :
gone through some of the available solution but no success!!!
If you change something the conflict will be occur, do like remove your WorkSpace once and again install or update your Pods,it will Work
Run pod install or pod update your CocoaPods installation.
For additional Information see this1
Choice-2
there's a problem with Cocoapods in your project. Sometimes cocoapods can get out of sync and you need to re-initiate cocoapods. You should be able to resolve this error by:
Deleting the Podfile.lock file in your project folder
Deleting the Pods folder in your project folder
Execute pod install in your project folder
Do a Clean in Xcode
Rebuild your project
Conclusion: don't run pod install while project opened in the Xcode.
Update answer
I. Project Cleanup
In the project navigator, select your project
Select your target
Remove all libPods*.a in Linked Frameworks and Libraries
II. Update CocoaPods
Launch Terminal and go to your project directory.
Update CocoaPods using the command pod install
I have solved my problem by this way :
After implementing lot many solution i got this error :
By removing Check pods manifest.lock, Copy pods resources and Embed pods frameworks from Build Phases of Tests project target(xxxTests) i solved the issue.
NOTE: If any one still getting any issue related to pods, then try to remove libpods-xxx.a from Link Binary with libraries and again add it.

Cannot install third party library

I keep trying to add https://github.com/jessesquires/JSQMessagesViewController into my project but it keeps coming up with a linking error.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't know what I am doing wrong I can't seem to add the demo into a blank project and get it to work.
This is what I'm doing:
I download the zipfile which contains the demo project folder (not an entire xcode project, just the .h and .m files needed for the demo).
I open a blank xcode project and insert the demo project folder.
I delete the blank project's plist, storyboard, main and app delegate files.
From the terminal, I cd into the project and make a podfile that looks like this:
platform :ios, '7.0'
pod 'JSQMessagesViewController'
pod 'JSQSystemSoundPlayer'
I run pod install.
I open the project in its new workspace that has the pods and I try to run it.
It throws the linking error.
What step am I missing? I see on the GitHub installation process it says:
#import <JSQMessagesViewController/JSQMessages.h> // import all the things
but I don't know what that means. I figured it meant something about updating your headers seach path but when I look at that under Build Settings its already pointing to the header file in the pods.
Is there an obvious step I'm missing when adding a third party library?
I installed JSQMessagesViewController through cocoapods in my project, I did not get any errors successfully installed.Please try the following steps:
Open Terminal and navigate to the directory containing your project by using the cd command:
cd ~/Path/To/Folder/Containing/Project
Next enter this command: pod init
Type this command to open Podfile using Xcode for editing:open -a Xcode Podfile.
Copy and paste this line: pod 'JSQMessagesViewController', '6.1.3' and save it.
Type this command: pod install
This installs dependent libraries related to JSQMessagesViewController and JSQSystemSoundPlayer.
After this close the project and go to your project folder ,use the workspace intead of xcodespace : yourProject.xcworkspace. Hope this post might help you.
1.Open a brand new project from Xcode, do not delete anything.
2.cd ~/ROOT_PATH_OF_YOUR_PROJECT
3.Edit your Podfile if your already had one
Podfile
platform :ios, '7.0'
pod 'JSQMessagesViewController'
pod 'JSQSystemSoundPlayer'
4.run pod install
5.open yourproject.xcworkspace
6.Build

Resources