如何在 xcode 4.3 中将项目或库导入 ios 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10090292/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:56:10  来源:igfitidea点击:

How to import project or library to ios app in xcode 4.3

iphoneobjective-ciosxcode

提问by Jesse Durham

I have downloaded an iOS projectand would like to know how to import this into my app in xcode 4.3. Do I have to copy over every single .h and .m file into my project? or can I just import it as a library type thing. And if so, how?

我已经下载了一个 iOS 项目,想知道如何将它导入到我在 xcode 4.3 中的应用程序中。我是否必须将每个 .h 和 .m 文件复制到我的项目中?或者我可以将它作为库类型的东西导入。如果是这样,如何?

回答by Antonio MG

The easiest way is just downloading the whole project, and copy the whole folder in your project (drag and drop in your project navigator)

最简单的方法是下载整个项目,然后复制项目中的整个文件夹(在项目导航器中拖放)

Then, you add the .h in the class you want to use and thats all!

然后,在要使用的类中添加 .h,仅此而已!

回答by Matej Bukovinski

This really depends on the library or component in question. Most open source projects provide some sort of documentation or guidelines that guide you through a suggested inclusion scenario. Cocoa-Touch-Barcodes is one of the few exceptions that don't give you any hints.

这实际上取决于相关的库或组件。大多数开源项目都提供某种文档或指南,指导您完成建议的包含场景。Cocoa-Touch-Barcodes 是少数不给您任何提示的例外之一。

In general you have several options for a library like Cocoa-Touch-Barcodes, two of the more convenient ones being:

一般来说,对于像 Cocoa-Touch-Barcodes 这样的库,您有多种选择,其中两个更方便的是:

  1. Create a workspace and add the library to it (see this tutorialfor details).
  2. Nest the project inside of your existing project and set it up as a dependency (see the three20 guide, the "Manually add Three20 to your project" section too see and example - for Cocoa-Touch-Barcodes it's even simpler as you don't have several projects and bundles).
  1. 创建一个工作区并将库添加到其中(有关详细信息,请参阅本教程)。
  2. 将项目嵌套在现有项目中并将其设置为依赖项(请参阅three20 指南,“手动将 Three20 添加到您的项目”部分也请参阅和示例 - 对于 Cocoa-Touch-Barcodes,它更简单,因为您没有有几个项目和捆绑包)。

In theory, the first approach is better and considered the modern way of doing things, but unfortunately there still seem to be some Xcode related quirks here. For the time being I would still recommend doing the second approach.

从理论上讲,第一种方法更好,并且被认为是现代的做事方式,但不幸的是,这里似乎仍然存在一些与 Xcode 相关的怪癖。目前我仍然建议采用第二种方法。