iPhone Project Dependency Management

Has anyone had any success in finding a reliable, generalised solution for managing dependencies for iPhone projects? I'm looking to split my iPhone applications up into reusable components and then pull them into projects that require them. I guess I'm looking for a Maven-esque workflow but for Xcode/iPhone projects. I've tried a number of things so far such as:

  • I've created a Maven plugin for iPhone applications which automates the building and signing of the applications but I constantly feel like I'm fighting against Maven to get this to work and it is altogether pretty messy. I'd rather not use this unless there are no other options.

  • I have also tried using static libraries to package the code up to re use but the problem with this is that I'd also like to include reusable XIBs and images in my projects and these cannot be included in the static library for redistribution. They are great for code but I'd like to have one system that does everything rather than different dependency management systems for different types of dependency.

  • At the moment I've settled on using the version control system to do my dependencies for me. In this case I'm using SVN externals to load the dependencies into the workspace when I checkout the project.

  • Does anyone have any ideas as to what I could do?

    Update

    I'm now using CocoaPods to perform this task.


    The way I've done it in the past is as follows:

  • Static Library for shared code
  • Bundle for Images / Data Files / Etc (Non Code)
  • By doing this, you only ever have to worry about updating the project that manages your static library / bundle and not the applications that use them.

    The key thing to creating a bundle, is that Bundles are not listed under iOS when adding a new target to a project. Instead they are listed under Mac OS X. Don't worry, it works great.

    Once you've created your Bundle and Static Library targets, you'll need to get those into your application:

  • Add the Static Library under Link Binary With Libraries (Xcode 4)
  • Add the Bundle under Copy Bundle Resources (Xcode 4)
  • The final thing to keep in mind is that when you want to load resources from the newly created bundle you need to do something like the following if you were going to load an image:

    UIImage *myImage = [UIImage imageNamed:@"YourBundle.bundle/MyImage.png"];


    With Static Libraries, you can distribute the XIB's/Images/Strings in a Bundle Folder which can be imported easily. It is the easiest approach I've found for distributing dependencies short of distributing the actual Code/Xcode Project

    链接地址: http://www.djcxy.com/p/8462.html

    上一篇: 使用C#安装Msmq

    下一篇: iPhone项目依赖管理