Search Unity

Unity Iphone App Embebed in objectiveC app

Discussion in 'iOS and tvOS' started by Shuank, Jun 8, 2010.

  1. Shuank

    Shuank

    Joined:
    Jun 8, 2010
    Posts:
    17
    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!
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    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 :) )
     
  3. Shuank

    Shuank

    Joined:
    Jun 8, 2010
    Posts:
    17
    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!
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I don't think you understood it right.

    A unity iphone game IS AN XCODE app :)
    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.
     
  5. Shuank

    Shuank

    Joined:
    Jun 8, 2010
    Posts:
    17
    Yes, i understand that.

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

    Thanks!
     
  6. Shuank

    Shuank

    Joined:
    Jun 8, 2010
    Posts:
    17
    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!
     
  7. ihonahan

    ihonahan

    Joined:
    Mar 29, 2011
    Posts:
    1
    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:

    Code (csharp):
    1.  
    2.  
    3.  
    4.  
    5. #ifdef __cplusplus
    6. extern "C" {
    7. #endif
    8.     void UnitySendMessage(const char* obj, const char* method, const char* msg);
    9. #ifdef __cplusplus
    10. }
    11. #endif
    12.  
    13. #define printf_console printf
    14.  
    15. #define IPHONE_TRAMPOLINE 1
    16.  
    hope this helps! ;)

    But about that, unfortunately to me, I'm getting another error in my merged apps:
    Code (csharp):
    1.  
    2.  
    3. 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
    4.  
    5.  
     
  8. Malsh

    Malsh

    Joined:
    Feb 12, 2013
    Posts:
    8
    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!