iPhone项目依赖管理 [英] iPhone Project Dependency Management

查看:100
本文介绍了iPhone项目依赖管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人在寻找可靠的通用解决方案来管理iPhone项目的依赖关系方面是否有任何成功?我希望将我的iPhone应用程序拆分为可重用的组件,然后将它们拉入需要它们的项目中。我想我正在寻找一个Maven风格的工作流程,但是对于Xcode / iPhone项目。到目前为止,我尝试了很多方法,例如:

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:


  1. 我创建了一个 Maven插件对于自动构建和签署应用程序的iPhone应用程序,但我总是觉得我正在与Maven对抗以使其工作,而且它完全是混乱的。除非没有其他选择,否则我宁愿不使用它。

  1. 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.

我也尝试使用静态库打包代码重新使用,但问题是我还想在我的项目中包含可重用的XIB和图像,这些不能包含在静态库中以进行重新分发。它们非常适合代码,但我希望有一个系统能够完成所有事情,而不是针对不同类型的依赖关系管理系统。

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.

目前我已经决定使用版本控制系统为我做依赖。在这种情况下,当我签出项目时,我正在使用 SVN externals 将依赖项加载到工作区中。

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?

更新

我现在正在使用 CocoaPods 来执行此任务。

I'm now using CocoaPods to perform this task.

推荐答案

我过去的做法如下:


  • 共享代码的静态库

  • 图像/数据文件的捆绑/等(非代码)

通过这样做,您只需要担心更新管理静态库/包的项目而不是使用它们的应用程序。

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.

创建捆绑包的关键是,在向项目添加新目标时,未在iOS下列出捆绑包。相反,它们列在Mac OS X下。不用担心,它运行良好。

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.

一旦你创建了Bundle和Static Library目标,你需要将它们放入您的应用程序:

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


  • 在Link Binary With Libraries(Xcode 4)下添加静态库

  • 在Copy Bundle Resources下添加Bundle(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];

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

这篇关于iPhone项目依赖管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆