2013-02-27 105 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 
相關問題