-6

我需要在不使用主页按钮的情况下退出应用程序。我调用 exit(0) 方法正在工作。这是退出应用程序或任何问题的正确方法吗?如果有其他退出应用程序的方法?. 请帮我..

4

3 回答 3

1

any another way to exit application?

在您的应用程序 plist 文件中添加Application does not run in background键并设置其值。YES当您的用户按下主页按钮时,应用程序将关闭。

于 2013-02-27T11:47:31.587 回答
0

您可以使用abort();或引发 NSException ,这将导致应用程序崩溃。

以编程方式退出应用程序不是推荐的行为,您应该向用户显示警报,说明您的应用程序需要退出的原因,并告诉用户他如何退出您的应用程序以使其看起来不就像您的应用程序有问题一样。

于 2013-02-27T11:30:31.490 回答
0
iOS Human Interface Guidelines says Don't Quit Programmatically. we have seen many of apps that had calls to exit(0) previously.
    Apple provided the different stages to exit the app. For that they provided different methods. So by exit() code its not proper to exit the app since the app will get rejected by Apple.
    you can refer this Apple Doc at http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/UEBestPractices/UEBestPractices.html#//apple_ref/doc/uid/TP40006556-CH20-SW27
于 2013-02-27T12:49:51.463 回答