2013-02-27 62 views
-6

我需要退出应用程序,而不使用主页button.I调用exit(0)方法正在工作。 它是退出应用程序或任何问题的正确方法?如果有其他方式退出应用程序? 。 请帮我..如何使用objective-c代码退出iPhone应用程序?

+1

http://stackoverflow.com/questions/8003519/close-app-when-internet-is-not-available – Ankur 2013-02-27 11:29:28

+0

请通过下面的链接以获得解决您的问题 的http://计算器.COM /问题/ 355168 /妥善路到退出iPhone应用程序 – Rajesh 2013-02-27 11:41:23

回答

0

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

这不是建议的以编程方式退出应用程序的行为,您应该向用户显示警告,说明您的应用程序需要退出的原因,并告诉用户他如何退出应用程序,以便它看起来不像你的应用程序是越野车。

1

any another way to exit application?

添加Application does not run in background键,在应用程序plist文件将其值设置YES。当你的用户按回家按钮,然后应用程序将被关闭。

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 
相关问题