CocoaPods "editable" mode? - objective-c

Python's Pip has an -e flag that can be used to install the package as a full git repo so it can be worked on and changes pushed back to origin master. What's the equivalent command for CocoaPods?
Is there a way to install a pod as a full git repo/submodule so commits can be made?

Use --no-clean when using pod install and pod update. This will keep the .git folder in Pods/[YOUR_POD] to allow you to commit/push directly from it.
Note: This currently does not work for SVN-backed pods as of 0.28 as cocoadpods uses the svn export command.

Related

AppCenter doesn't seem to run pod install despite existence of Podfile

I've got a react-native app that builds on AppCenter. I have a Podfile in my /ios directory, and locally, I can run pod install. The AppCenter documentation says that "App Center scans the selected branch and if it finds a Podfile, it will automatically do a pod install step at the beginning of every build. This will ensure that all dependencies are installed.", but as far as I can tell, it's not running pod install for my build and the build fails for that reason.
Tried adding pod install to a pre-build script, in which case the build succeeds.
Make sure the Cocoapods version running on the build agent matches the one on your podfile.lock.
You can add a post clone script like this on your ios/ folder:
appcenter-post-clone.sh This will automatically install the matching cocoapods version.
Push that file to your repo, then make sure you open the build configuration and hit Save and Build.
It appears that in addition to having a Podfile, you must NOT have a ios/Pods folder present. In my case, I also had to explicitly add that folder to my .gitignore

Someone ran 'pod update' and now my app crashes with podfile.lock issue

We have gone through all the steps a million times:
$ sudo gem install cocoapods
$ rm -rf Bizzy\ Books.xcworkspace
$ pod install
Deleting derived data... changing build settings...
NOTHING is working! And all because one guy ran "pod update" and then didn't know what to do after that!
This is the error code:
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock
/Users/Owner/Library/Developer/Xcode/DerivedData/Bizzy_Books-ajpeiroanshownarpormfcnuuvik/Build/Intermediates/Bizzy\
Books.build/Debug-iphoneos/Bizzy\
Books.build/Script-76499205B9A6D7551C8D0832.sh
cd "/Users/Owner/Desktop/Bizzy Books"
/bin/sh -c \"/Users/Owner/Library/Developer/Xcode/DerivedData/Bizzy_Books-ajpeiroanshownarpormfcnuuvik/Build/Intermediates/Bizzy\
Books.build/Debug-iphoneos/Bizzy\
Books.build/Script-76499205B9A6D7551C8D0832.sh\"
diff: /Podfile.lock: No such file or directory error: The sandbox is
not in sync with the Podfile.lock. Run 'pod install' or update your
CocoaPods installation.
I am looking for somebody that knows what they are doing on this!
Plus, people are blaming me for having "old code" which is only like a week or two since the last pod install in which I had no problems. And there are no errors shown with the code, only with the podfile.lock issue.
And people are downloading from Github and saying it works fine therefore I have no problem, which doesn't help me, because when I pull from Github, it makes no difference, showing the same error!
Here is the github repository:
https://github.com/caldwbr/Bizzy-Books-iOS
Well I finally got it working.
I opened the folder for my app and deleted Bizzy Books.workspace, Podfile, Podfile.lock, and the Pods folder, and emptied the trashcan. (Fairly important, if you don't want to see a slew of red untracked files hanging around after you do 'git status')
Then I navigated inside terminal to this same folder and ran:
git fetch --all
git reset --hard origin/master
Then I tested, and it worked!
I had been doing "git fetch --all" followed by "git pull --hard origin master," but I needed to do "git fetch --all" followed by "git reset --hard origin/master" and MAKE SURE NOT to do any "pod install" or "pod update"! That is the command that is giving me grief!
So thankful this is fixed!!!
There must be some incompatibility with a newer version of on of the pods in my podfile that just isn't working, hence I have to go back to the older version of that pod (not of cocoapods itself I don't think). Or there may be an issue with podfile.lock being funky as when you run 'pod update' or 'pod install' it generates a new podfile.lock file.

cocoa Pod svn issue

I have integrated cocoa pod in my project. The workspace was successfully created and all is fine. After that I committed the same to SVN. Now when someone else takes a checkout, they get the follwing error.
diff: /<path to cocoa pod>/Pods/../Podfile.lock: No such file or directory
diff: /<path to cocoa pod>/Pods/Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your Cocoa Pods installation.
Also the workspace is also not created.
I can suggest you little workaround here.
Before initial commit to SVN, ignore "Pods" folder in project files.
Create new project
terminal : pod init
Add your dependencies to podfile
terminal : pod install
terminal : svn propset svn:ignore Pods .
// ignores Pods folder under project folder.
Do your first commit to SVN
terminal : svn commit -m "FIRST COMMIT"
When others checkout project from SVN, they need to pod install once and ignore "Pods" folder.

cocoapod : pod setup failed with fatal error

I successfully installed cocoapod by using "gem install cocoapods". After that trying to set up pod by using "pod setup", but gives fatal error.
sh-3.2# pod setup
Setting up CocoaPods master repo
[!] Pod::Executable clone 'https://github.com/CocoaPods/Specs.git' master
Cloning into 'master'...
error: transfer closed with outstanding read data remaining while accessing https://github.com/CocoaPods/Specs.git/info/refs?service=git-upload-pack
fatal: HTTP request failed
please help me to solve this..
This issue appears to be just a temporary network issue. Try to verify if you can clone the https://github.com/CocoaPods/Specs repo in a folder manually.
1 - first install git (command line tool for mac)
link to download is : http://git-scm.com/download/mac
2 - then open commind line (or terminal) and type
$ sudo gem install cocoapods (you need to wait here , be patient)
3 - now you can shoot the command "pod --version" to check the version of the pod you just installed.
4 - Write again on terminal $ pod search libpusher (just an example of a library, you can type any library name here instead of 'libpusher' ).
5- let it be complete , it may take some time.
6- then most imp step , create the pod file , (name can be 'podfile') in your project directory and add it to your project in Xcode.
7 - Now Here the secret is : you need to provide the path to this pod file too here , so type command:
cd /Rakesh/vidyo_demo/vidyo_phonegap/ios (eg.)
after cd command rest is the path of the pod file directory.
8- and now when you will type 'pod install ' command in terminal.
and all libraries (which are written in podfile) will get installed on your project path. just then open the project which now has a workspace file. like demo.xcworkspace (open it)
9- here is the format of pod file:
platform :ios, '7.0'
pod 'libPusher', '~> 1.4'
This issue has been already reported to cocoapods.
Ok, after a few hours lost, it seems if my project path contains
single quotes or spaces, things fail. Sigh.

'pod install' doesn't update an existing pod

I am trying to update my pod using pod install and finding that it doesn't update properly unless I delete the original pod.
Is there some extra step required or is there a common mistake that makes updates fail?
I'm not sure from which version, but if you update your cocoapods installation to the latest version, you'll find two new commands to help with this.
pod outdated
This will list all pods that have updates available.
pod update
This will update the pods listed in the previous command
You can add the verbose tag and see if there is an error showing up during the update.
pod install --verbose
Using --verbose is the best way to find out what is going on. Maybe there is a problem with the repo it is trying to update from. Hard to say.
I think reader of this Question must understand difference between
pod install vs. pod update
Many people starting with CocoaPods seems to think that pod install is only used the first time you setup a project using CocoaPods and pod update is used afterwards. But that's not the case at all.
Use pod install to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods.
Use pod update [PODNAME] only when you want to update specific pod to a newer version.
Use pod update only when you want to update every pod to a newer available version.
Every time the pod install command is run — and downloads and install new pods — it writes the version it has installed, for each pods, in the Podfile.lock file. This file keeps track of the installed version of each pod and locks those versions.
When you run pod install, it only resolves dependencies for pods that are not already listed in the Podfile.lock.
For pods listed in the Podfile.lock, it downloads the explicit version listed in the Podfile.lock without trying to check if a newer version is available
For pods not listed in the Podfile.lock yet, it searches for the version that matches what is described in the Podfile (like in pod 'MyPod', '~>1.2')
If your project is configured correctly, you should be able to delete the entire Pods directory and run pod install. I find that this is sometimes the best solution when having issues with pods not being installed properly.
Note: If you begin getting errors such as this when you build:
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
... you may need to close and reopen the project in Xcode.
Warning: make sure all the files in your Pods directory are going to be recreated before deleting the Pods directory. (I.e. make sure you didn't manually modify or add files to the Pods directory.)