Iphone: Good practice for updating my third-party libraries?

I want to ask about your practices to keep your third-party libraries up to date.

In my iPhone project, I use quite a few third-party libraries (such as TouchXML, JSON, RegexKit, YAJL, MGTwitterEngine ...). Most of them are stored on GitHub, and their version, especially MGTwitterEngine, changes quite quickly (due to adding a new function, fixing bugs, changing the format of the response to the server (for example, Twitter) ...).

Sometimes I forget to update (I also do not want to change the stable version), then my project gets errors due to outdated libraries.

When I got the error because the old libraries. I often drop by Github, download the new version, and then change a lot of code. Since downloading a new version means that I am making a quick transition from a very old version to the latest version. I think it will be less painful if I update the library more often.

What is your approach to this task?

+7
objective-c iphone xcode
source share
2 answers

Have you looked at the git submodules ?

I use them for this task. We have a repository of helper classes. However, when we make additions and improvements, we want these improvements to be cascaded for all of our projects, so we created this auxiliary repository as a submodule in each project repository.

Try the following command from the root directory of the repository:

git submodule add ssh://url/to/external/library.git local/path 

This should take the following steps (taken verbatim from the URL above):

  • Clones the submodule under the current directory and by default checks the main branch.
  • Adds the path of the submodule clones to the .gitmodules file and adds this file to the index, ready for execution.
  • Adds the current submodule commit id to the index ready for commit.

Then you can use

 git submodule update 

to maintain relevance.

In addition, as a side note, if you are doing what I am (for example, by making direct changes to the submodule repository), you need to go to the root repository directory of the submodule and transfer the changes FIRST before you make the superproject. This is due to the fact that git tracks versions of submodules (smart), so if you first commit a superproject, you will keep a link to changes that were not committed to the submodule repository. Anyone trying to clone your super project will get an error.

+4
source share

Now is 2012, and since this question was asked, two projects have arisen that are aimed at simplifying the management of project dependencies in iOS code: CocoaPods and VendorKit . Both are inspired by the Ruby Bundler dependency manager. CocoaPods is probably the most mature and active project, but both are gaining strength.

Git Submodules help a lot when organizing your project and dependencies, but it can still be difficult to correctly find search paths and links, not to mention what is wrong if the dependencies break. It is also difficult to cope with a situation where A and B depend on C, where A is your own project, and B and C are dependencies. Therefore, my advice at this point would be to use one of these projects and support them by writing specifications for various libraries.

There is also a lesser-known Kit implemented in Haskell. Worth checking out.

+5
source share

All Articles