Cannot install third party library - ios

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

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

The Podfile does not contain any dependencies [duplicate]

I'm doing the Ray Wenderlich tutorial called SimpleWeather.
The podfile is in the same folder as the project.
Here's my code from the podfile:
platform :ios, '7.0'
xcodeproj 'SimpleWeather'
pod 'Mantle'
pod 'LBBlurredImage'
pod 'TSMessages'
pod 'ReactiveCocoa'
The error message is this: [!] Unable to find the Xcode project /Users/myName/Developer/SimpleWeather.xcodeproj for the target Pods.
The name of the project is SimpleWeather.
I'm pretty sure you are not in the right directory. Are you sure your .xcodeproj is in the Developer folder? There might be a subfolder you need to navigate to.
The right way to enable CocoaPods in your Project is:
Open Terminal and execute: $ sudo gem install cocoapods
Navigate to your Project folder (I assume in your case it's cd /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj).
Setup Cocoapod pod setup
Create the Podfile touch Podfile
Open the Podfile open -e Podfile and insert your code for Podfile
Finally install the Podfile pod install
If you follow this instructions everything should work. When opening your project make sure to open the .xworkspacefile.
For more information, see this.
This error also occurs when you have multiple .xcodeproj in your Xcode project.
You don't need more than one .xcodeproj in general cases. Remove unnecessary .xcodeproj, and Cocoapods should get the correct path automatically afterwards.
Reiterating our original conversation:
Accordingly to Podfile Syntax Reference the Podfile looks right.
Make sure you are running $pod install from your project directory:
/Users/myName/Developer/SimpleWeather
Hey your path for the project might be wrong. Go to the project and right click on SimpleWeather.xcodeproj and select Get Info as show in the image below(The right side window is for Get Info here). Copy this path from the details window and paste it into the Podfile. After that append /SimpleWeather.xcodeproj to that pasted path. This might solve the problem(Note: It is a snap shot for my project). In your case the solution might be replacing the path with this /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj
To solve this issue, just follow below steps and your issue will get resolved :
Step 1 : Open Terminal and navigate to your project folder
Step 2 : touch podfile
Step 3 : open -e Podfile
Step 4 : Write below line in your text edit and close it
workspace '/Users/systemName/Developer/yourprojectname/yourprojectname.xcworkspace'
Step 5 : Pod install
And after successful process, you will not get this error again.
CheersKP
Maybe you have two project .xcodeproj, remove one.
Remove Podfile.lock, folder Pods. On Terminal cd /Users/myName/Developer/SimpleWeather and pod install
For people who are on Mac and also using code editors, the duplicate file that is causing this issue is ._projectname.xcodeproj because it has the same extension as the regular .xcodeproj files.
I had the same problem.
Then with many attempts of trials and errors I finally got the working solution:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'SimpleWeather'
pod 'Alamofire', '~> 3.4'
This works when you are in your project directory (I assume you should navigate using terminal to /Users/myName/Developer/SimpleWeather/)
You installed your Xcode..in application use this command to execute
sudo xcode-select -switch /Applications/Xcode.app
so okay i had tried every possible thing ...i had only one .xcodeproj file
but sill i couldnt install so finally i had tried with the following
1. open terminal cd to your project folder one with .xcodeproj
2. type pod init
3. type touch Podfile
4. type pod install
Magic happens and your pod files gets installed
Check your Podfile for the following lines
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
under
target '<project_name>' do
Hopefully this answer can be useful in times of many people using SPM. My case was the following: I had a binary framework package that had to be converted to the cocoapod, together with it's dependency tree. In the git repository where the package lived, the .gitignore file contained this line: /*.xcodeproj. This meant that even though everything worked fine locally, whenever the CI tried to run pod install it failed.

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

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

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

How do I select a project in my Podfile? I'm getting the error: Unable to find the Xcode project for the target 'Pods'

I'm doing the Ray Wenderlich tutorial called SimpleWeather.
The podfile is in the same folder as the project.
Here's my code from the podfile:
platform :ios, '7.0'
xcodeproj 'SimpleWeather'
pod 'Mantle'
pod 'LBBlurredImage'
pod 'TSMessages'
pod 'ReactiveCocoa'
The error message is this: [!] Unable to find the Xcode project /Users/myName/Developer/SimpleWeather.xcodeproj for the target Pods.
The name of the project is SimpleWeather.
I'm pretty sure you are not in the right directory. Are you sure your .xcodeproj is in the Developer folder? There might be a subfolder you need to navigate to.
The right way to enable CocoaPods in your Project is:
Open Terminal and execute: $ sudo gem install cocoapods
Navigate to your Project folder (I assume in your case it's cd /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj).
Setup Cocoapod pod setup
Create the Podfile touch Podfile
Open the Podfile open -e Podfile and insert your code for Podfile
Finally install the Podfile pod install
If you follow this instructions everything should work. When opening your project make sure to open the .xworkspacefile.
For more information, see this.
This error also occurs when you have multiple .xcodeproj in your Xcode project.
You don't need more than one .xcodeproj in general cases. Remove unnecessary .xcodeproj, and Cocoapods should get the correct path automatically afterwards.
Reiterating our original conversation:
Accordingly to Podfile Syntax Reference the Podfile looks right.
Make sure you are running $pod install from your project directory:
/Users/myName/Developer/SimpleWeather
Hey your path for the project might be wrong. Go to the project and right click on SimpleWeather.xcodeproj and select Get Info as show in the image below(The right side window is for Get Info here). Copy this path from the details window and paste it into the Podfile. After that append /SimpleWeather.xcodeproj to that pasted path. This might solve the problem(Note: It is a snap shot for my project). In your case the solution might be replacing the path with this /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj
To solve this issue, just follow below steps and your issue will get resolved :
Step 1 : Open Terminal and navigate to your project folder
Step 2 : touch podfile
Step 3 : open -e Podfile
Step 4 : Write below line in your text edit and close it
workspace '/Users/systemName/Developer/yourprojectname/yourprojectname.xcworkspace'
Step 5 : Pod install
And after successful process, you will not get this error again.
CheersKP
Maybe you have two project .xcodeproj, remove one.
Remove Podfile.lock, folder Pods. On Terminal cd /Users/myName/Developer/SimpleWeather and pod install
For people who are on Mac and also using code editors, the duplicate file that is causing this issue is ._projectname.xcodeproj because it has the same extension as the regular .xcodeproj files.
I had the same problem.
Then with many attempts of trials and errors I finally got the working solution:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'SimpleWeather'
pod 'Alamofire', '~> 3.4'
This works when you are in your project directory (I assume you should navigate using terminal to /Users/myName/Developer/SimpleWeather/)
You installed your Xcode..in application use this command to execute
sudo xcode-select -switch /Applications/Xcode.app
so okay i had tried every possible thing ...i had only one .xcodeproj file
but sill i couldnt install so finally i had tried with the following
1. open terminal cd to your project folder one with .xcodeproj
2. type pod init
3. type touch Podfile
4. type pod install
Magic happens and your pod files gets installed
Check your Podfile for the following lines
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
under
target '<project_name>' do
Hopefully this answer can be useful in times of many people using SPM. My case was the following: I had a binary framework package that had to be converted to the cocoapod, together with it's dependency tree. In the git repository where the package lived, the .gitignore file contained this line: /*.xcodeproj. This meant that even though everything worked fine locally, whenever the CI tried to run pod install it failed.

Resources