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
Related
My podfile is this.
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
target 'Task Tracker' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Task Tracker
pod 'RealmSwift', '~> 10'
end
I am trying to run pod install
It gives me error LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi_c.bundle, 0x0009): dependent dylib '#rpath/libffi.7.dylib' not found for '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi_c.bundle' - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi_c.bundle
What I tried
gem install ffi
arch -x86_64 pod install
Still same error. What am I missing?
If you're using Intel chip Mac and getting this error after trying the above command also, it's because of the cocoa pods installed on your Mac (Not installed properly). Completely remove the cocoapods and install it again from the beginning. This solution will work.
Jump to /usr/local/opt/libffi/lib, and ln -s libffi.8.dylib libffi.7.dylib
tips: libffi.8.dylib is your current ffi lib
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
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
I'm trying to install Firebase via CocoaPods for my Objective-C iOS Application. My Podfile is as follows:
target 'RandomName' do
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
When I run pod install, I get the following error:
[!] Unable to satisfy the following requirements:
- `Firebase/Core` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Firebase/Core`.
You have either:
* out-of-date source repos which you can update with `pod repo update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
The latest version of CocoaPods is installed, and I have tried running pod repo update. Having a Podfile of the following works fine, but when I try to #import Firebase; in my AppDelegate.m file, Xcode cannot find the module.
target 'RandomName' do
pod 'Firebase'
end
However, the following combination does not install:
target 'RandomName' do
pod 'Firebase'
pod 'Firebase/AdMob'
end
Any help would be appreciated!
Check what version of Firebase is installed when you use pod 'Firebase'. For me it installs 2.4.3 which is an old version. The docs say that the pod should install 3.2 using that pod. It explains why the other pods don't work as they are part of Firebase 3. Pod update doesn't update Firebase to the latest version either. Even forcing a version doesn't work. It can't seem to find the new Firebase versions even though they are in the same podspec.
Here is how I solved it:
make sure you have the latest version of git installed
make sure you have cocoapods >= 1.0.0 installed
delete your pods repo (run pod repo remove master) and use pod setup to make a new one
use the following in your pod file
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Core'
(use whatever you want, just don't use 'Firebase')
pod install
everything should install properly
Running 'pod repo remove master' to remove the Pods repo //removes the library
Running 'pod setup' //clones the updated git repo for specs which takes long time as its size is beyond 300K (Be patient!)
Running 'pod install' //problem is solved
have you tried to add
frameworks
use_frameworks!
after target 'RandomName' line
and adding
platform :ios, '9.0'
before target ....
A couple of items to try. From your question, you did try the first two items, but leaving here for completeness of my answer.
The error response you get is helpful. Follow the steps for pod repo update
Make sure your pod is up to date.
pwd> pod --version
1.0.0
Make certain that your git is up to date. I had a build machine that had an outdated git (1.7), and I had the same exact error
-
When I updated to this version from git 1.7 it worked fine.
pwd> git --version
git version 2.8.1
My Podfile for using Firebase Dynamic Links
run pod init from the folder where your .xcodeproj is
Be sure to only launch the .xcworkspace instead of the .xcodeproj from here out.
platform :ios, '8.0'
use_frameworks!
target 'the-name-of-target' do
pod 'Firebase/DynamicLinks'
end
The Same problem occurred while on pod install command.
Please relaunch terminal and navigate to your Xcode project then
simply fire same pod install command. 'Firebase/Database' will installed successfully :)
I just doing following step to fix this error:
$pod setup -- verbose
Then do $pod install
that works for me and my pod file is:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'the-name-of-target' do
pod 'Eureka', '~> 1.6'
end
UPDATE:
Then you can remove your master and re-install cocoapods using following code:
cd ~/.cocoapods/repos
rm -rf master
pod setup
I had the same error, and my solution was to downgrade Cocoapods to 1.0.0, because Cocoapods 1.0.1 didn't work as I expected. Everything works great now!
sudo gem uninstall cocoapods -v 1.0.1
sudo gem install cocoapods -v 1.0.0
My Podfile:
platform :ios, '8.0'
target 'XXX' do
pod 'Firebase/Auth'
pod 'Firebase/Database'
end
For people still having problems with this. When directly coping the firebase walkthourgh website, the install string is:
pod `Firebase/Core`
While it should have been:
pod 'Firebase/Core'
No need for pod setup if this applies to you too.
Update Git and Cocoapods to the last version:
Git: $ brew update && brew upgrade
Cocoapods: $ pod repo update
I am currently getting the following error when running pod install:
[!] Invalid `Podfile` file: undefined method `source' for #<Pod::Podfile:0x007fcf91b8c7a8>. Updating CocoaPods might fix the issue.
# from /Users/preston/Work/Test/Podfile:1
# -------------------------------------------
> source 'https://github.com/CocoaPods/Specs.git'
# platform :ios, '8.0'
# -------------------------------------------
I have tried the following:
pod repo remove master; pod setup
rm -rf ~/.cocoapods; pod setup
sudo gem uninstall cocoapods; sudo gem install cocoapods
After running the last bullet point I ran pod setup and got the following:
Setting up CocoaPods master repo
Already up-to-date.
CocoaPods 0.36.0 is available.
To update use: [sudo] gem install cocoapods
Setup completed (read-only access)
Which is confusing because I just updated.
Evening after running all of these commands I am still getting the above error. Does anyone know what might be going wrong?
Edit:
Here is my Podfile. However everything worked on another computer but not on mine:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!