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?
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.
Thank you.
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:
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.
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.(Italics above because "delegate" is a pattern used in many places in iOS development. You may well have many objects that are a delegate of one kind or another, but only one will be the app delegate).
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.