Unity Iphone App Embebed in objectiveC app

Hi! , i am a Game Developer From Argentina, im working on a web based game with Unity, and now im making my first Iphone (with Unity) App.

I already have experience developing apps for iPhone, and i have an app written in Objective-C , im wondering if there are any way of making an embed unity app in the ObjectiveC App.

Ive already deploy my iphone unity game to the iphone , and i see that an xCode project is generated, so im guessing that maybe i can put the app launch code in someplace in my Objective C Application.

Somebody have done this before?

I can maybe try something like openURL if i register an URL for my iphone Unity App, but i dont want to have two icons in the iPhone Menu.

Sorry if my English is not so good.

Thanks in advance!

just integrate your xcode application into the generate xcode project and you are fine. The relevant code you need to check is in pretty obvious places (there aren’t that many, just follow the red line from the did finish starting function on in the app controller :slight_smile: )

So, my solution will be ““launching”” the unity app from my xCode App, and then , when i exit from the Unity app capture that exit from the xCode App and make my stuff.

If anyone has a advice, or a known problem doing this, ill be very thankful.
@dreamora Thank you very much!

I don’t think you understood it right.

A unity iphone game IS AN XCODE app :slight_smile:
What you are meant to do is integrate your app into the iphone xcode project and start the unity engine where you require it, and pause it when you no longer require it etc.

Yes, i understand that.

Maybe it seems like i doesnt cause my english sucks xD.

Thanks!

Hi again!

Im merging the two apps, but im getting the error

/iPhoneMerge/app/Classes/AppController.mm:394:0 /iPhoneMerge/app/Classes/AppController.mm:394: error: ‘printf_console’ was not declared in this scope

a lot of times (95 times).

Ive copyed all the classes from my Unity App (generated automatically by Unity ), into my working Objective C App, ive also copy the frameworks and the library folder.

Any clue?

Thank you!

What you need to do to avoid this error is to define the printf_console in your code. Actually, what I did was to copy all this into my _Prefix.pch file:

#ifdef __cplusplus
extern "C" {
#endif 
	void UnitySendMessage(const char* obj, const char* method, const char* msg);
#ifdef __cplusplus
}
#endif 

#define printf_console printf

#define IPHONE_TRAMPOLINE 1

hope this helps! :wink:

But about that, unfortunately to me, I’m getting another error in my merged apps:

ld: ldr 12-bit displacement out of range (4476 max +/-4096) in _AudioComponentFindNext$stub in _AudioComponentFindNext$stub from /TestiPhoneEmbed/TestIPhoneEmbed/build/TestIPhoneEmbed.build/Debug-iphoneos/TestIPhoneEmbed.build/Objects-normal/armv6/TestIPhoneEmbed

hi , did u find a solution to integrate those 2 apps. i put the unity generated code into my already created xcode app and having the following error now.

Mono path[0] = ‘/var/mobile/Applications/7157EDFD-B1B4-4EA8-AE52-9F9966BBED10/atSpot.app/Data/Managed’
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/var/mobile/Applications/7157EDFD-B1B4-4EA8-AE52-9F9966BBED10/atSpot.app/Data/Managed/mono/2.0/mscorlib.dll’ directory.

if anybody get this error can immediately reply?
Thank you!