iOS 中多个项目之间共享代码的最佳方式

发布于 2024-12-11 15:18:20 字数 498 浏览 0 评论 0原文

我们计划在 AppStore 中推出一系列应用程序。它们将针对某种不同的期刊,显示通过 XML 从服务器下载的不同内容。因此,这些应用程序将由完全相同相同的代码组成(这是一个通用应用程序,因此它可以在 iPhone/iPad 中运行)。

我最初的想法是,为了上传应用程序,只需更改图像、徽标和配置(plist)即可进行编译,使应用程序作为特定日志做出反应。压缩后的文件将上传到AppStore。

然而,这导致了一种可怕的方法,它会导致失败和错误。如果我忘记更改某些图像,因为您无法在编译文件中看到它们(因为它已包含在内),它们最终会出现在商店中(我需要四到五天才能更改应用程序)。

我正在尝试寻找更好的方法,使项目尽可能独立。我希望能够共享整个代码库:视图、类和笔尖,并为每个期刊创建不同的项目。

哪种方法是实现这一目标的最佳方法?什么结构可以让我将逻辑(控制器、类)和 UI 分组并在不同的项目中使用它?

我希望我已经解释过了。

一如既往,非常感谢。

We're planning to launch a serie of applications in AppStore. They will be for some kind of different journals, showing different contents downloaded from a server via XML. So these applications will be made from exactly the same code (It's an universal application, so It'll work both in iPhone/iPad).

My initial idea was, in order to upload the application, compile just changing the images, logos and configurations (plist) that makes the application react as a particular journal. The compressed file would be uploaded to the AppStore.

However, this has resulted a horrible method, which promotes failures and mistakes. If I forget to change some image, as you can't see them in the compiled file (as it is included) they will end up in the store (and I will need four or five days in order to get the application changed).

I'm trying to look up for a better approach, wich keep the projects as independent as possible. I would like to be able to share the entire codebase: views, classes and nibs and create different projects for every journal.

Which is the best method to achieve that?. What structure would let me group both logic (controllers, classes) and UI and use it in the different projects?.

I hope I've explained.

As always, thank you very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

丶情人眼里出诗心の 2024-12-18 15:18:20

您应该将大部分通用代码保留为库项目。每个最终项目都应与该项目链接,并提供图像/资产以及代码,以将这些资产提及到通用代码。在我的日常工作中,我也编写了一个通用库,它被我雇主的 2 个产品/应用程序使用。

You should keep most of your common code as a library project. Each final project should link with this project and provide images/assets along with code to mention these assets to common code. In my day job, I write a common library too, which gets used by 2 products/apps at my employer.

溺深海 2024-12-18 15:18:20

一个 Xcode 项目可以有多个 Target,所有 Target 共享代码,但每个 Target 从同一项目目录/文件夹内的不同子目录/文件夹获取自己的资源(图标、图像、文本、plist 等)。然后,您可以将整个内容或仅共享源代码检查到源代码控制存储库中。

您还应该在上传到商店之前在设备上测试每个应用程序,其构建方式与任何提交的方式完全相同(除了协同设计之外)。

An Xcode project can have multiple Targets, all the Targets sharing code, but each Target getting its own resources (icons, images, text, plists, etc.) from a different subdirectory/folder within the same project directory/folder. Then you can check the whole thing, or just the shared source, into your source control repository.

You should also be testing each of your apps, built exactly the same way as any submission except for the codesigning, on a device before uploading to the store.

漫雪独思 2024-12-18 15:18:20

您可以使用一个 Xcode 项目来创建多个应用程序。您需要为每个应用程序创建一个单独的 Info.plist,其中包含不同的包标识符。

You can have a single Xcode project that creates multiple applications. You'll need to create a separate Info.plist with a different bundle identifier for each app.

半葬歌 2024-12-18 15:18:20

如果您使用 git 存储库,您只需为您想要的每个不同应用程序进行分支,这将跟踪所有差异,如果您需要切换正在处理的应用程序,您只需签出该分支即可。这将允许完全相同的结构,只是每个实际代码之间存在细微差别。

If you are using a git repository you can just branch for each different app you want and that would keep track of all the differences and if you need to switch which you are working on you just have to checkout that branch. This would allow for the exact same structure just minor differences between the actual code for each.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文