2011-09-14 48 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

相关问题