Search Unity

Problem with closing Unity from native IOS app

Discussion in 'Editor & General Support' started by voropserg, Jun 5, 2020.

  1. voropserg

    voropserg

    Joined:
    Jan 11, 2019
    Posts:
    3
    Hello. I Have a problem with close unity application in native app. When I'm opening unity app from native application, every time RAM is increasing and after N times application is crashed.

    How I run unity app from native:
    ```
    Code (CSharp):
    1.     NSArray* arguments = [[NSProcessInfo processInfo] arguments];
    2.     NSInteger count = [arguments count];
    3.     char **array = (char **)malloc((count + 1) * sizeof(char*));
    4.  
    5.     for (NSInteger i = 0; i < count; i++) {
    6.         array = strdup([[arguments objectAtIndex:i] UTF8String]);
    7.     }
    8.     array[count] = NULL;
    9.     char** argv = array;
    10.  
    11.     [[UnityFramework getInstance] registerFrameworkListener: self];
    12.     [[UnityFramework getInstance] runEmbeddedWithArgc:1 argv:argv appLaunchOpts:mad:{}];
    ```
    How I close unity app:
    ```

    Code (CSharp):
    1.     [[UnityFramework getInstance] unloadApplication];
    2. -  (void)unityDidUnload:(NSNotification*)notification {
    3.     [[UnityFramework getInstance] unregisterFrameworkListener: self];
    4.  
    5.     AppDelegate *app = (AppDelegate*) UIApplication.sharedApplication.delegate;
    6.     [app.window makeKeyAndVisible];
    ```

    Here's the rep ofor more details: https://github.com/DenisDemyanko/UnityProblems