Unable to Install cocoaPods in already existing Xcode project - ios

I do have an existing project in Xcode (swift 3) in which a detailed UI has been designed. I am still unable to install CocoaPods into that project.
All the guides I've seen on how to install cocoa pods people CREATE A NEW PROJECT and install it in that NEW PROJECT, however, I want to install it in an existing (designed UI) project. Trying to install cocoa pods in that project lead me to a workspace that shows everything empty and red lines everywhere on the left see the screenshot and suggest a solution, please. Thanks!

Please follow the below steps for installing pods to an existing project:
Open Terminal and navigate to the directory that contains your project by using the cd command:
cd ~/Path/To/Folder/Containing/Project
Next, enter the following command:
pod init
This creates a Podfile for your project.
Finally, type the following command to open the Podfile using Xcode for editing:
open -e podfile
It opens the podfile for you.
Now edit podfile to add required frameworks. it should look similar to below snippet.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectTarget' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Messaging'
# Pods for ProjectTarget
target 'ProjectTarget-iOSSDKTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectTarget-iOSSDKUITests' do
inherit! :search_paths
# Pods for testing
end
end
Then after pods will be integrated to the project and .xcworkspace will be created.
Next time open the .xcworkspace to continue with the project.

Related

How do I access cocoa pods library and add a module to it?

I am using macincloud to do some xcode work and I have a xcode package that works fine on the computer it was made on, but in macincloud I get a no module error. How do I check on my pod library, is it part of the of the computer or is part of my code?
I have read about opening up terminal and typing in different commands to install pods but nothing is working
Here is what is in my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'WallpaperBoard' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'IQKeyboardManagerSwift'
pod 'Google-Mobile-Ads-SDK'
pod 'DBImageColorPicker'
pod 'SSUIViewMiniMe'
# Pods for WallpaperBoard
end
Cocoapods is a dependency manager. Running the pod install command on Terminal, it downloads all the Pods as external dependencies and creates a .xcworkspace for your project.
It needs to be run once in every different computer you run your project.
On Mac In Cloud:
Open Terminal
Navigate to the project folder, where the Podfile is. Usually you can navigate with the cd command. Example:
cd /Users/user_name/Desktop/project_folder
Run the command to install the Pods:
pod install
Open the generated .xcworkspace file

Adding cocoapods into my PodFile

I am working on an app, which requires cocoapods. In the manual of this app is written
Add this to your Podfile:
pod 'SwiftSocket'
And run then pod install
But when I make a pod file using pod init into my folder and then open -a Xcode Podfile and there I add lines
target 'SwiftSocket' do
pod 'SwiftSocket'
end
and the last pod install it says me an error
Unable to find a target named SwiftSocket, did find SwiftSocket iOS, SwiftSocket macOS, SwiftSocket tvOS, and iOS Example.
Edit____________
Picture of my folder.
and how looks my Podfile now
It is working perfectly, check out my podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'Demo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'SwiftSocket'
# Pods for Demo
end
Demo is the project name. Target name will be your project name.

Setting up cocoa pods with a react native project

I've set up a fresh react native project, and instantiated a cocoa pod .xcworkspace doing:
cd ios
pod init
pod install
I've then added a pod that I want to use (in this case being Buddybuild, although it doesn't really matter which pod i add, as the behavior is similar)
After I run pod install and include the header #import <BuddyBuildSDK/BuddyBuildSDK.h> in my AppDelegate.m , it is always returning me a /Users/nik/dev/myproject/ios/myproject/AppDelegate.m:14:9: 'BuddyBuildSDK/BuddyBuildSDK.h' file not found
I've battled with this all day and I have no idea why. The headers are all there in the Pods/headers/Public folder. They're being included in the header search paths in build settings as well as you can see here:
I'd highly appreciate help on this as I'm very stuck.
EDIT Also here's my Podfile:
Turns out the issue was an xcode thing. After much Googling the issue that solved it was making sure that my projects configurations were properly set. So going to Project -> Info -> Configurations And choosing the right Pods-projectName.debug and Pods-projectName.release configurations.
For RN 0.58.6 I noticed you don't need any react or react-native pods.
If you create a brand new project using react-native init (for 0.58.6) you will notice there is no need for a pod file.
My pod file looks like this:
platform :ios, '9.0'
project 'MyRNProject.xcodeproj'
install! 'cocoapods', :deterministic_uuids => false
target 'MyRNProject' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Add pods that you need here
target 'MyRNProject' do
inherit! :search_paths
# Pods for testing
end
end
In Project target Linked framework or libraries I have:
framework deps (CoreFoundation.framework, SystemConfiguration.framework Pods_MyRNProject.framework etc)
RCT and RN deps
other libs that I use

I'm getting framework not found <library> when installing with cocoapods

I installed Google Sign In via cocoapods, but when I tried to compile got this error
ld: framework not found GoogleAppUtilities
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'Project_name' do
pod 'PayPal-iOS-SDK'
pod 'Google/SignIn'
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Project_name
target 'Project_nameTests' do
inherit! :search_paths
# Pods for testing
end
target 'Project_nameUITests' do
inherit! :search_paths
# Pods for testing
end
end
I installed the PayPal library first without problem.
I'm using .xcworkspace
Tried cleaning and building again, using $pod deintegrate
clean the project and $pod init again and nothing seems to change.
In Xcode, look in the Pods project for a file named GoogleAppUtilities.framework. It's probably under the Pods/Products folder. You need to add a reference to this file (GoogleAppUtilities.framework) in your main project. In you main app project file go to the build settings tab and look at the list named "Link Binary with Libraries"...you need to add a reference here to the GoogleAppUtilities.framework file.
Just adding your comment as the solution: it worked for mee too:
Solved, I thank you. Your answer did not solve the issue, but It gave
me an idea. I did that and in Build
Settings->SearchPaths->FrameworkSearchPaths I added the framework in
Debug and Release.

IOS Run custom shell script 'embed pods framework' file not found error

I am getting an error when building my app after i removed reference to a framework i added incorrectly. i am new to ios and cocoapods
/Users/MyMac/Library/Developer/Xcode/DerivedData/MyApp-ewxrexwuczochyctnqvlyusrtvvy/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-5874133373474758EEC76CFD.sh: line 2: /Users/MyMac/Documents/MyApp/Pods/Target Support Files/Pods-MyApp/Pods-MyApp-frameworks.sh: No such file or directory
I am aware that the file and directory don't exist and that is the way it should be but where is it finding the reference to this file so i can remove it and be rid of the error.
I have checked the following:
Linked Frameworks andLibraries under the general tab of my project
The frameworks group in the project
framework search paths under build settings tab
i have also run pod update after removing it from the pod file
How can i fix this?
Edit
back story
I was trying to add the framework https://github.com/Alliants/ALAccordion . in the instruction it said to use
# Podfile
target 'My Target' do
use_frameworks!
pod "ALAccordion"
end
so i added MyApp where my Target is and it created a framework named Pods-MyApp which i cant remove completely.
hope this helps
Cocoapods wrote a tool to completely deintegrate all of this stuff from your project so it goes back to running standalone. It sounds like you had an issue adding the correct target, so use this:
https://github.com/CocoaPods/cocoapods-deintegrate
Then try again so you can at least start from good ground. Hope this helps!
It happened with a prerelease version of Cocoapods 1.2.0.beta.1, by reverting to stable version and running pod install, then clean build, it worked.
why
use_frameworks!
after
target ... do
here is example
platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!
target 'XXX' do
pod 'RealmSwift'
end
target 'XXXTests' do
pod 'RealmSwift'
end

Resources