Remove only a library from cocoapod project, how i can do? - ios

I have an app that holds two libray installed with cocoapods, Braintree and GoogleAnalytics. What i wanna do is remove Braintree from my project. This is my Podfile in the root of my project:
# Uncomment this line to define a global platform for your project
# platform :ios, '7.0'
target 'MyApp' do
pod 'Braintree'
pod 'Google/Analytics'
end
target 'MyAppTests' do
pod 'Braintree'
end
I have tried this solution , but maybe i do something wrong. My steps are: Open terminal -> go to root directory of my project -> $ pod update. This returns to me "pod update command not found". What's wrong or what are the correct steps to remove the Braintree library?

Update your pod file in following manner
# Uncomment this line to define a global platform for your project
# platform :ios, '7.0'
target 'MyApp' do
#pod 'Braintree'
pod 'Google/Analytics'
end
target 'MyAppTests' do
#pod 'Braintree'
end
Above file, I have commented the Braintree library. Now you need to execute pod update or pod install.
As you are facing error of "pod update command not found", you should first install the cocoapods in your mac as guided in https://stackoverflow.com/a/37939140/1030951 answer.

Try running this command
sudo gem intall cocoa pods
And then try pod update again

Related

Alamofire install failed - Xcode 8.1

Recently upgraded to XCode 8.1 trying to install Alamofire pod for a new project. Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'app' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for app
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'swift3'
end
And my terminal responds:
image
so what can I do?
--Update--
also tried pod 'Alamofire', '~> 4.0'
here is the result
I did the pod repo update it doesn't do anything at all
Edit your podFile as below and just install the pods using pod install --verbose command if still error exists then update your repo with pod repo update then try again.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'app' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for app
pod 'Alamofire'
end
As per the discussion here,
You need to use
pod 'Alamofire', '~> 4.0'
In your pod file
I faced the same problem when i updated the mac os from el capitan to sierra and installed new version of Xcode.
I updated the cocoapod and still, was facing the same problem.
I found a solution by completely removing cocoapod from root directory and installing it again.
To remove the cocoapod completly use this in terminal
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
and then install the cocoapod again
$ gem install cocoapods

Unable to find a specification for `Firebase`

I'm unable to install Firbase pod, when trying:
pod install
Analyzing dependencies
[!] Unable to find a specification for `Firebase`
Here is my podfile :
platform :ios, '9.0'
target 'login' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for login
pod 'Firebase'
pod 'Firebase/Auth'
end
Maybe your pod isn't synced? Try:
pod repo update --verbose
In my case the problem was with my local pod repo. I fixed by doing the following:
pod repo remove master
pod setup
pod install
You could try
pod 'Firebase/Core'
Instead of just pod 'Firebase'.
I had the same problem and it worked for me.
Try below commands:
pod repo remove master
pod repo update
pod install --verbose

Setting up shared common Pods for multiple targets within projects

I am trying to install Pod using abstract_target to share common Pods for multiple target. I am follow CocoaPods to install Pods. But it generates following error.
[!] Invalid `Podfile` file: undefined method `abstract_target' for #<Pod::Podfile:0x007fcd7380d098>. Updating CocoaPods might fix the issue.
# from /Users/Sagar/Desktop/CocoaPodsMultipleTarget/Podfile:5
# -------------------------------------------
#
> abstract_target "Networking" do
#
# -------------------------------------------
I updated my CocoaPods and my current version is :
/Users/Sagar/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/cocoapods-1.0.0.beta.2/lib/cocoapods.rb
Below is my Podfile.
# Uncomment this line if you're using Swift
use_frameworks!
abstract_target 'Networking' do
pod 'AlamoFire'
target 'CocoaPodsMultipleTarget' do
platform :ios, '9.0'
pod 'IQKeyboardManagerSwift'
end
target 'MyWatchDemo Extension' do
platform :watchos, '2.0'
end
end
Is there any thing wrong with my Podfile ?
Any help or suggestion should be appreciated.
Are you sure your version of CocoaPods is 1.0 and not 0.39.0? Using abstract_target only works on 1.0 and above. In your terminal...
Check version:
$ pod --version
Update for the pre-release version:
$ [sudo] gem install cocoapods --pre
For reference: https://guides.cocoapods.org/using/getting-started.html

Issue with importing framework in Swift with Cocoapods

I am new to Swift, but I learned the basics. I wanted to import a framework but I ran into issues. I will now explain what steps I followed and what failed.
I installed cocoapods by using terminal command: sudo gem install cocoapods
I then navigated to my projects root directory with terminal then used command: pod init
It created a podfile, and I edited it as I have shown below.
platform :ios, '8.0'
use_frameworks!
target 'Testy' do
end
target 'TestyTests' do
pod 'Kingfisher', '~> 1.8.1'
end
target 'TestyUITests' do
pod 'Kingfisher', '~> 1.8.1'
end
I then closed xcode and started the project by clicking 'Testy.xcworkspace' file.
At this point, I did not add any code, just built the project without issues, problems start here.
When i try to import my framework and build, it gives the follow error:
Cannot load underlying module for 'Kingfisher'
So what might be the problem here? If you need additional info, ask me and I can provide.
In your Podfile, you do not have "pod 'Kingfisher', '~> 1.8.1'" listed for the target "Testy".

CocoaPods pod install. Modules cannot be imported

I installed CocoaPods by using $ sudo gem install cocoapods.
I have a swift Xcode project with the following podfile
platform :ios, '8.2'
use_frameworks!
target 'Clover' do
pod 'Alamofire', '~> 1.2'
pod 'SwiftyJSON', '~> 2.2'
pod 'ObjectMapper', '~> 0.12'
pod 'ImageLoader', '~> 0.3.0'
pod 'SVProgressHUD'
end
target 'CloverTests' do
end
After I run pod install, which seems to run correct with no error messages, I have a Pods folder generated with Pods.xcodeproject along with several other files.
However, when attempting to compile the project, I will into errors telling me my modules are not found. The error message is No such module followed by the module name.
I then attempted to install the modules manually and confirmed that the pods are indeed not working as each module after its manual installation, works.
I have searched and attempted several solutions as follows:
Deleted and reinstall pod.
Upgraded ruby to 2.2.1
Delete the pods folder and re-run $ pods install.
Clean the project.
More a comment than an answer, but I don't have enough reputation to comment:
When you use pod install with your-project.xcodeproject, it creates a new file/folder named your-project.xcodeworkspace (…project becomes …workspace) and this is this new file that you should open.
You didn't mention whether or not you knew that, so here you go: close the .xcodeproject in Xcode and open the .xcodeworkspace instead and it should work.

Resources