您可以在带有Xcode子项目的另一个iOS应用程序中运行一个iOS应用程序吗? [英] Can you run an iOS app within another iOS app with Xcode sub projects?

查看:100
本文介绍了您可以在带有Xcode子项目的另一个iOS应用程序中运行一个iOS应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近购买了一些迷你游戏的源代码,希望将其包含在当前的复杂应用程序中.但是,我很难在我的应用程序中实际实现迷你游戏.最初,我尝试将源文件复制到我的项目中,但是偶然遇到了两个独立的应用程序委托的问题.可以有两个单独的代表吗?

I have recently purchased some source code of a mini game that I wish to include in my current complex application. However I am having difficulties actually implementing the mini game into my app. Initially I tried copying the source files into my project but stumbled across problems with having two separate app delegates. Is it possible to have two separate delegates?

我想介绍的另一种方法是将迷你游戏项目添加为Xcode子项目.但是我不确定这是否可行,如果可行,我将如何去做呢?如果您知道更好的方法,将非常感谢您提供任何帮助.

Another method I though about was by adding the mini game project as an Xcode subproject. However I'm not sure if this is possible, and if it is, how would I go about doing so? If you know a better method, I would appreciate greatly any sort of help.

谢谢.

推荐答案

您将需要执行以下操作之一,具体取决于您的特定需求以及所购买的此源代码可能适用的任何许可证:

You're going to need to do one of the following, depending on your specific needs and on whatever licenses may apply to this source code that you purchased:

  • 构建一个新应用,并将部分或全部迷你游戏的源代码复制到您的应用中(或将该代码添加为子项目,但请继续阅读以获取更多信息).
  • 获取现有迷你游戏的源代码并对其进行修改,直到它成为您需要的为止.

在两种情况下,都将涉及对传入源代码的一些理解,包括其结构和操作.此信息的最佳来源可能是卖方.

In both cases it's going to involve some understanding of the incoming source code, including its structure and operations. The best source for this information is probably the seller.

要回答提出的一些具体问题:

To answer some specific questions raised:

您可以在具有Xcode子项目的另一个iOS应用程序中运行一个iOS应用程序吗?

Can you run an iOS app within another iOS app with Xcode sub projects?

不.您无法在另一个句号内运行一个iOS应用程序.如果您对源代码足够了解,则可以将其从一个以上的应用程序合并到一个新的应用程序中.

No. You can't run one iOS app inside of another, full stop. You can merge the source code from more than one app into one new app if you understand the code well enough.

我...偶然发现了两个独立的应用程序委托的问题.可以有两个单独的代表吗?

I ... stumbled across problems with having two separate app delegates. Is it possible to have two separate delegates?

不是两个 app委托.应用程序委托特别是共享的单例 UIApplication 对象的委托对象.在代码方面,应用程序委托是 [[[UIApplication sharedApplication]委托] 的值.那不是数组或其他集合,而是一个对象.您最有可能必须查看两个应用程序委托类的功能,然后将其功能合并为一个.

Not two app delegates. The app delegate is specifically the delegate object of the shared, singleton UIApplication object. Code-wise, the app delegate is the value of [[UIApplication sharedApplication] delegate]. That's not an array or other collection-- it's a single object. Most likely you're going to have to look at what the two app delegate classes do and merge their functionality into one.

(上面的斜体是因为"delegate"是iOS开发中许多地方使用的模式.您可能有许多对象是一种或另一种委托,但只有一个是应用程序委托).

我想介绍的另一种方法是将迷你游戏项目添加为Xcode子项目.但是我不确定这是否可行,如果可行,我将如何去做呢?

Another method I though about was by adding the mini game project as an Xcode subproject. However I'm not sure if this is possible, and if it is, how would I go about doing so?

这是可能的,但不可能解决您的问题.子项目通常用于来自不同来源(例如库或框架)的外部依赖项(例如,如果您使用的是 AFNetworking ,则可以选择使其成为子项目).在您的情况下,这可能是个好主意(或者可能没有,如果没有更多细节,就不可能说).但单靠它并不能解决如何将这个迷你游戏的功能纳入您的应用程序的问题.

This is possible but it's not likely to be a solution to your problem. Subprojects are commonly used for external dependencies from different sources, like libraries or frameworks (e.g. if you were using AFNetworking you might choose to make it a subproject). That might be a good idea in your case (or might not, it's impossible to say without a lot more detail). But on its own it doesn't fix the problem of how to get this mini-game's functionality into your app.

这篇关于您可以在带有Xcode子项目的另一个iOS应用程序中运行一个iOS应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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