2011-09-14 44 views
0

可能重複:
quit app in iOS4iPhone:在iPhone應用程序終止

您好,我是在iphone的研究與開發初學者。我正在爲iphone4兼容iPhone應用程序。 我正在顯示一個警報視圖,並選擇一個是導航到brouwser.its確定,但我的應用程序將在background.but我希望它終止和shuld重新啓動時單擊應用程序圖標。

if (alertView.tag==222) { 
     if (buttonIndex==0) { 
      [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"http://itunes.apple.com/"]]; 

     } 
} 

當我點擊主頁按鈕時,它也正在走向bground。 我想要應用程序應該從後臺終止也。

+0

exit()怎麼樣? –

+2

@Daniel你不應該叫退出。 – rckoenes

+1

其他可能的重複:http://stackoverflow.com/questions/3227736/iphone-avoid-save-state,http://stackoverflow.com/questions/5565730/iphone-app-startup,http://stackoverflow.com/questions/6127560/how-do-i-tell-ios-that-i-do-not-the-app-to-stay-in-the-the-the-background,http://stackoverflow.com/questions/4437619/make-app-without-multitasking-support,http://stackoverflow.com/questions/6516519/how-to-restart-a-application-without-going-to-recent-worked-page-when-we退出 – Codo

回答

0

設置您的info.plist的Application does not run in background爲YES

+0

嗨thnks但在一個特定的條件我希望我的應用程序被終止(後臺應用程序刪除),但每次點擊在主頁按鈕它將被終止。 – user1210691

+0

無法真正關注你,但將其設置爲yes可以阻止你的應用在後臺運行。這意味着當用戶按下homebutton或者通過'openURL'方法打開其他應用程序時,它將停止運行。 – rckoenes

+0

謝謝rckoenes, – user1210691

-1

添加UIApplicationExitsOnSuspend/Application does not run in backgroundInfo.plist

+0

我應用了它,但每次它會終止應用程序,應用程序將從開始。在特定情況下,我希望應用程序終止。 – user1210691

相關問題