【发布时间】:2013-02-27 11:27:48
【问题描述】:
我需要在不使用主页按钮的情况下退出应用程序。我调用 exit(0) 方法正在工作。 这是退出应用程序或任何问题的正确方法吗?如果有其他退出应用程序的方法? . 请帮帮我..
【问题讨论】:
-
请查看以下链接以获取您的问题的解决方案stackoverflow.com/questions/355168/…
标签: iphone objective-c
我需要在不使用主页按钮的情况下退出应用程序。我调用 exit(0) 方法正在工作。 这是退出应用程序或任何问题的正确方法吗?如果有其他退出应用程序的方法? . 请帮帮我..
【问题讨论】:
标签: iphone objective-c
any another way to exit application?
在您的应用程序 plist 文件中添加 Application does not run in background 键并设置其值 YES。当您的用户按下主页按钮时,应用程序将关闭。
【讨论】:
您可以使用abort(); 或引发 NSException,这将导致应用程序崩溃。
不建议以编程方式退出应用程序,您应该向用户显示一个警报,说明您的应用程序需要退出的原因,并告诉用户他如何退出您的应用程序以便它不会'看起来你的应用程序没有问题。
【讨论】:
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
【讨论】: