简体   繁体   English

使用XCode将外部项目添加到我的iPhone应用程序

[英]Add external project to my iphone app in xcode

Just starting to poke around iPhone development. 刚开始围绕iPhone开发进行讨论。 I am trying to add an external project/library to mine (specifically the ASIHTTPRequest, http://allseeing-i.com/ASIHTTPRequest/ ). 我正在尝试添加一个外部项目/库来进行挖掘(特别是ASIHTTPRequest, http: //allseeing-i.com/ASIHTTPRequest/)。

I am at a bit of a loss as to how I go about actually adding this dependency to my project. 我对如何将这种依赖关系真正添加到我的项目感到有些茫然。 I come from a Visual Studio/C# world, and in Visual Studio I know I would "Add Existing Project" to my solution file and then add a reference to the new project to my own. 我来自Visual Studio / C#世界,在Visual Studio中,我知道我会在解决方案文件中“添加现有项目”,然后将对新项目的引用添加到我自己的解决方案文件中。 Or, alternatively, reference the DLL directly if it is already built. 或者,如果已经构建了DLL,则直接引用它。

The ASIHttpRequest project is on GitHub, and provides full source code. ASIHttpRequest项目位于GitHub上,并提供完整的源代码。 I just don't have any idea about how to actually get this dependency into my own project. 我只是不知道如何将这种依赖关系真正放入我自己的项目中。 I tried "Project -> Add To Project", and just selected the folder ASIHTTPRequest extracted out into. 我尝试了“项目->添加到项目”,然后选择了提取到其中的文件夹ASIHTTPRequest。 I see it as a sub-folder to my project now... but get a ton of build errors. 我现在将其视为我项目的子文件夹...但是会遇到大量构建错误。 I removed everything but the .h and .m files from this subfolder, and now I don't get any build errors from those resources anymore, but trying to reference a ASIHTTPRequest object in my own project gives "undeclared" errors. 我从该子文件夹中删除了.h和.m文件之外的所有内容,现在我不再从这些资源中获取任何构建错误,但是尝试在我自己的项目中引用ASIHTTPRequest对象会产生“未声明的”错误。

Am I missing something here? 我在这里想念什么吗? Can I not of these .h and .m files in subfolders? 我不能在子文件夹中使用这些.h和.m文件吗?

You're on the right track. 您走在正确的轨道上。 You just need to #import the ASIHTTPRequest header in the file where you want to use it. 您只需要在要使用它的文件中#import ASIHTTPRequest标头。 You do have to make sure you've met all the dependencies specified on the ASI site , but once you've done that, everything should work right by just doing an import like you've described. 您必须确保已满足ASI站点上指定的所有依赖关系 ,但是一旦完成此操作,则只需执行如前所述的导入就可以正常工作。 Once all that is set and everything is compiled, add this: 设置完所有内容并编译完所有内容后,添加以下内容:

#import "ASIHTTPRequest.h"

to the top of the file where you want to use the library. 到要使用库的文件顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM