Reputation: 1087
I was trying to integrate google analytics into my project, and I was surprised that it requires cocoapods to install google analytics now.
I followed the documentation here:
https://developers.google.com/analytics/devguides/collection/ios/v3/?hl=en
I called pod init on terminal, and then I've edited by podfile to
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
target 'Unity-iPhone' do
pod 'Google/Analytics', '~> 1.0.0'
end
target 'Unity-iPhone Tests' do
end
and I get the following error on terminal when I call pod install.
Updating local specs repositories Analyzing dependencies [!] Unable to find a specification for
Google/Analytics (~> 1.0.0)
[!] CocoaPods was not able to update the
master
repo. If this is an unexpected issue and persists you can inspect it runningpod repo update --verbose
It also did not generate the .xcworkspace file.
How can I fix this issue?
Edit:
I tried the answer by Steffen to setup the master repo again, and I get this error now.
Analyzing dependencies [!] Unable to satisfy the following requirements:
Google/Analytics (~> 1.0.0)
required byPodfile
Although my podfile still contains pod 'Google/Analytics', '~> 1.0.0'
Upvotes: 3
Views: 12477
Reputation: 4569
I had this problem on OS X El Capitan Version 10.11.5
Path to your XCode project folder
$ cd /path/to/xcode/myProject/
Create the Podfile using command
$ pod init
pod 'Google/Analytics'
to the generated Podfile# Uncomment this line to define a global platform for your project # platform :ios, '8.0' # Uncomment this line if you're using Swift # use_frameworks! target 'myProject' do pod 'Google/Analytics' end
Try to install the pod which fails
$ pod install
-bash: pod: command not found
Try to install cocoapods which also fails
$ sudo gem install cocoapods
ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
You need to install activesupport which then lets you install cocoapods okay but then the pod install fails with a new bug
$ sudo gem install activesupport -v 4.2.6
$ sudo gem install cocoapods
$ pod install
[!] Unable to find a specification for 'Google/Analytics'
Perform these last steps and the pod install will finally succeed
$ pod repo remove master
$ pod setup
$ pod install
NB Some of these command line actions take a long time to complete and Terminal gives you no indication that it is doing anything, it appears broken but is working quietly therefore needs patience.
So sad that we still have to resort command line in 2016
Upvotes: 9
Reputation: 2926
Sounds like your master repo is somehow corrupt. I would try the following:
pod repo remove master
pod setup
Upvotes: 1