How to update your CocoaPod (when you forgot how to do it)

imageNamed non valido (e altri problemi con i resource files) dopo la creazione di un CocoaPod

CocoaPod is wonderful but, let's just face it, their documentation sucks. The whole guide website is mostly inaccurate and implies you already have an extensive know-how of their interface and terminology, which tend to be unfriendly and differ from almost any other developer environment, be it linux, windows or even mac. Hence why there is a recurring scenario, for me at least, when I have to create a new Pod - or update my existing one - and I simply cannot remember how to effectively do that. Not even a clue. Not at all.

That's why I resolved to write it down, at least for the update process. Here it is, hoping to save someone else's day other than mine.

  • Hop to your favorite (virtualized) Mac.
  • Perform a Pull of your project from your GitHub or BitBucket repo to your local repo, just to be sure to retrieve any possible change made from the web interface (merged pull requests, etc.).
  • Open XCode and perform all the code changes you need to do using your local file, issuing zero, one or more local Commits along the way.
  • When you're done, update the .podspec file increasing the s.version  number, for example from 1.11 to 1.12.
  • Test your build by opening a cmd shell, navigate to your CocoaPod's main folder and type: pod lib lint
  • Perform a final Commit to your local, non-GitHub repo with your latest changes (including the previous one in the .podspec file).
  • Right after the local Commit, assign a tag identical to the the s.version  number (1.12 in our example).
  • Synchronize/Push everything to your GitHub repo.
  • Shell to cmd, navigate to your CocoaPod's main folder and type: pod trunk push NAME.podspec

Bingo.

If only I could remember all this for more than 3 hours, I'll be even more happy.

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.