Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Podfile error while doing "pod install"?

I made my own cocoa pods using this tutorial. http://guides.cocoapods.org/making/making-a-cocoapod.html I pushed it to my own github repository. https://github.com/kidsid59/appExample When I tried to use it in my own sample project by making an entry in its podfile like

target "PodInstallDemoApp" do

pod ‘appExample’, :git => 'https://github.com/kidsid59/appExample.git'

end

And then tried to run "pod install" in terminal. It says :-

[!] Invalid `Podfile` file: undefined local variable or method `‘appExample’' for #    <Pod::Podfile:0x007f92e111dfc0>. Updating CocoaPods might fix the issue.

Looks like its failing to identify the pod name. I already wasted lot of time in this little advice would help.

like image 353
kidsid49 Avatar asked Jul 29 '14 13:07

kidsid49


People also ask

How do you fix a Podfile?

Simply run pod install (or bundle exec pod install if using bundler) to reinstall all the project's pods. This will regenerate the deleted Pods/ folder and create the correct checksum in Podfile. lock . That's it — you've now got both your changes merged, and you've fixed the merge conflict (at least, for the pods!).

How do you add pods to Podfile?

Run open Podfile. Which opens the Podfile in textEdit. Add pod'CorePlot', '~> 1.4' to it and save. Run pod install -- NOTE* that is **pod update if already installed.

What does Podfile mean?

~> (the optimistic operator) is used when you want to specify a version 'up to next major | minor | patch'. For example: ~> 0.1.2 will get you a version up to 0.2 (but not including 0.2 and higher)


2 Answers

You probably have edited your Podfile with TextEdit.app, which replace ' for "smart quotes" ( and .

Be sure to use regular quotes (').

like image 112
Marcelo Fabri Avatar answered Sep 29 '22 11:09

Marcelo Fabri


Note: You shouldn’t use TextEdit App to edit the pod file because TextEdit likes to replace standard quotes with more graphically appealing quotes. This can cause CocoaPods to get confused and display errors, so it’s best to just use Xcode or another programming text editor.

Using TextEdit App will give you following,

pod ‘AFNetworking’, ‘~> 2.5′    //notice the quotes

Use Xcode to open Podfile and you will get correct quotes as following,

pod 'AFNetworking', '~> 2.5'

Terminal Commands to open in Xcode:

$ touch Podfile  //OR $ cd <parentDirectory of Podfile>
$ open -a Xcode Podfile
like image 37
Ajith R Nayak Avatar answered Sep 29 '22 12:09

Ajith R Nayak