If UIApplicationMain () never returns, then when is the auto-resource pool freed?

For code:

int main(int argc, char *argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}

Apple doc clearly defines:

Return Value: Although an integer return type is specified, this function never returns. When users terminate the iPhone application by pressing the Home button, the application will exit immediately by calling the system exit function with an argument of zero.

Secondly, in   int UIApplicationMain ( int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName ); how can we access argv from our subclass of UIApplication?

+3
source share
3 answers

Auto settlement pool is not freed. Instead, the OS simply deletes your application from memory.

+8
source

argc argv, Apple :

NSApplicationMain argc argv. , Cocoa _NSGetArgv, _NSGetArgc _NSGetEnviron (. [Crt_externs.h]). G

+3

autorelease , UIApplicationMain , .

Apple: ( iOS " " )

, , .

+1

Source: https://habr.com/ru/post/1742547/


All Articles