Can't install GoogleMaps with CocoaPods - ios

I want to install the GoogleMap SDK for iOS in my project. But when I installed with pod install it got an error.
[!] Unable to find a specification for `GoogleMaps`
pod repo remove master ; pod setup doesn't help. pod repo update --verbose
Updating spec repo `.git`
$ /usr/bin/git -C /Users/admin/.cocoapods/repos/.git fetch origin
From https://github.com/CocoaPods/Specs
42723a4..830f47f master -> origin/master
$ /usr/bin/git -C /Users/admin/.cocoapods/repos/.git rev-parse --abbrev-ref
HEAD
HEAD
$ /usr/bin/git -C /Users/admin/.cocoapods/repos/.git reset --hard origin/HEAD
fatal: ambiguous argument 'origin/HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
[!] CocoaPods was not able to update the `.git` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`
My podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Interests' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Interests
pod 'GoogleMaps'
target 'InterestsTests' do
inherit! :search_paths
# Pods for testing
end
target 'InterestsUITests' do
inherit! :search_paths
# Pods for testing
end
end

You need to specify the Specs repo at the top of the Podfile as follows:
source 'https://github.com/CocoaPods/Specs.git'
I can see this is the case because of the error you have listed:
Updating spec repo `.git`
[!] CocoaPods was not able to update the `.git` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`

Using this approach of reinstalling via brew which fixed the issue.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
sudo gem uninstall cocoapods
brew install cocoapods --with-brewed-curl --with-brewed-openssl

Related

Travis CI fails iOS Build

I am trying to build an iOS(swift) project with Pods, with Travis CI but I am getting the the following error.
Analyzing dependencies
[!] The version of CocoaPods used to generate the lockfile (1.2.1.beta.1) is higher than the version of the current executable (1.2.0). Incompatibility issues may arise.
Pre-downloading: `SwiftValidator` from `https://github.com/jpotts18/SwiftValidator.git`, commit `2a6c23ad9efd76127f6109445515cb9780e5ad92`
[!] Unable to satisfy the following requirements:
- `Marshal (= 1.2.4)` required by `Podfile`
- `Marshal (= 1.2.4)` required by `Podfile.lock`
None of your spec sources contain a spec satisfying the dependency: `Marshal (= 1.2.4)`.
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 command "eval pod install " failed 3 times.
The command "pod install" failed and exited with 1 during .
Here is my .travis.yml file:
language: swift
osx_image: xcode8.3
branches:
only:
- develop
- master
env:
- LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8
before_install:
- rvm install ruby-2.2.2
- gem install cocoapods
- gem install xcpretty -N
- brew update
- brew install swiftlint || true
script:
- set -o pipefail
- xcodebuild -workspace Invision.xcworkspace -scheme Invision -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
- swiftlint
Reading through the log I can see that there is something wrong with the Pods. So here is my Podfile
platform :ios, '8.0'
target 'Invision' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Invision
pod 'ZLSwipeableViewSwift'
pod 'Moya'
pod 'Marshal', '1.2.4'
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :branch => 'master'
pod 'Log'
target 'InvisionTests' do
inherit! :search_paths
# Pods for testing
end
target 'InvisionUITests' do
inherit! :search_paths
# Pods for testing
end
end
I have also read about how to solve the problem and some of the suggestions were:
pod update Marashl - didn't work
Any ideas of how to solve this problem ?
It seems the code you pushed using CocoaPods 1.2.1.beta.1 but Travis-CI supports 1.2.0. gem install cocoapods installs the stable version of CocoaPods try installing beta version
xcode8.3 isn't supported yet hence you might be routed to the default image which is xcode7.3. See https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version.
Can you try with osx_image: xcode8.2?
Update 2017-05-15: xcode8.3 is now supported: https://blog.travis-ci.com/2017-04-19-xcode-832-is-here.

ios Unable to install dependency using Pods

I am trying to install AFNetworking using Pods. I've created a pod file and when I run pod install I get :
Unable to add a source with url
https://github.com/CocoaPods/Specs.git named master-1. You can try
adding it manually in ~/.cocoapods/repos or via pod repo add.
I tried cloning into ~/.cocoapods/reposbut it gives an error: fatal: destination path '.' already exists and is not an empty directory.
My PodFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.5'
Any suggestions?
Please update ios version
platform :ios, '7.1'
Please use updated AFNetworking 3.0
and add
platform :ios, '8.0'
Try removing this line:
source 'https://github.com/CocoaPods/Specs.git'
Updated:
Run pod init manually when you have an internet connection.
Go to ~/.cocoapods/repos and run git clone https://github.com/CocoaPods/Specs.git master
If the problem still persist, refer this
issue.
Just remove master repo:
rm -fR ~/.cocoapods/repos/master
After that, run:
pod setup

Firebase CocoaPods Installation Not Working

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

iOS Podfile error: undefined method 'source'

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!

Error on "sudo pod install"

I already have one project working with a podfile.
I wanted to add a Podfile on an old project but I got this error on
sudo pod install
Error:
Resolving dependencies of `./Podfile'
Updating spec repositories
[!] git pull
Updating 35bbbaf..8b42708
error: The following untracked working tree files would be overwritten by merge:
AFXAuthClient/1.0.4/AFXAuthClient.podspec
Please move or remove them before you can merge.
Aborting
It's weird because I don't use AFXAuthClient on my project, and I never used it.
Here's my Podfile:
platform :ios, '5.0'
pod 'TTTAttributedLabel', '~> 1.6.0'
pod 'ECSlidingViewController', '~> 0.9.0'
I tried to made without success:
gem install cocoapods
pod setup
NB: I get the same error with pod setup
From the command line run rm -rf ~/.cocoapods
Then run pod install again. You shouldn't need the sudo.
This look like it's caused because there was a change to a spec and it's conflicting with running a git pull
If you're seeing an error like this, it might be because CocoaPods had to force-push their repo. They suggest:
pod repo remove master
pod setup

Resources