iphone - 如果 UIApplicationMain() 永远不会返回,那么自动释放池什么时候被释放?

标签 iphone cocoa

代码:

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

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

Apple 的文档明确指出:

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

其次,在 int UIApplicationMain ( 整数argc, 字符*argv[], NSString *principalClassName, NSString *delegateClassName ); 我们如何从 UIApplication 子类访问 argv?

最佳答案

自动释放池没有被释放。相反,操作系统只是从内存中删除您的应用程序。

关于iphone - 如果 UIApplicationMain() 永远不会返回,那么自动释放池什么时候被释放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2702548/

相关文章:

objective-c - NSImageView 中心?

iphone - 将 UIView 的内容渲染为 OpenGL 纹理

ios - 如何调整 UITabBarItem 的大小?

iphone - AVAudioPlayer 错误加载文件

iphone - iPhone 设备上的静态库

macos - 当 Cocoa 应用程序启动时,如何确定按下的修饰键?

ios - NSHashTable 计数错误地报告非空

iphone - 禁用栏按钮文本颜色更改为白色?

c# - 用 C 编写的带有 Cocoa 前端的 OpenGL 游戏我想移植到 Windows

objective-c - 核心数据对象不会存储