简体   繁体   English

如何导入常规(而非库)xcode项目?

[英]how to import a regular (not library) xcode project?

I am writing a part of IOS project,called project1. 我正在编写IOS项目的一部分,称为project1。 Instead of changing other part of source code and storyboard to test my code, I want to create a new project, called project2, used to test code. 我不想更改源代码和情节提要的其他部分来测试我的代码,而是要创建一个名为project2的新项目,用于测试代码。 In order to do it, however, I need to import many libraries and source files used by project1. 为了做到这一点,我需要导入许多project1使用的库和源文件。 So I want to import project1 as the library of project2, how can I do it? 所以我想将project1导入为project2的库,该怎么办?

I just drag project1 into project2, but it didn't work 我只是将project1拖到project2中,但是没有用 在此处输入图片说明

You may want to consider instead of creating a whole different project, to simply create a new target within project 1 that is meant only for testing. 您可能需要考虑创建一个仅用于测试的新目标,而不是创建一个完全不同的项目,而只是在项目1中创建一个新目标。 It gets a different appID, info.plist, compilation settings, and anything else you want. 它得到一个不同的appID,info.plist,编译设置以及您想要的其他任何内容。

You can most easily start by right-clicking on your current target in the project info view, and selecting "duplicate target". 您可以通过在项目信息视图中右键单击当前目标,然后选择“复制目标”来最轻松地开始。 Then it starts with all of the current settings, libraries and source code files you have in your main project. 然后从您在主项目中拥有的所有当前设置,库和源代码文件开始。

That is also the way XCode works when you opt to include unit testing in a new project, so there is a good precedent for the approach. 当您选择在新项目中包含单元测试时,这也是XCode的工作方式,因此该方法有一个很好的先例。

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

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