inforeqd
inforeqd

Reputation: 3249

Closing app on iOS power button switch off

I am creating an iPad application on iOS5.0. I need it to close down if the user is in the app and presses the power off button on the iPad. The user would need to restart the app once he clicks the power button. How should I accomplish this?

Thanks in advance for your help on this one.

Upvotes: 4

Views: 788

Answers (3)

hchouhan02
hchouhan02

Reputation: 946

set this key

Application does not run in background=NO

in App-info.plist file, then add exit(0); to applicationDidEnterBackground

Upvotes: 1

Philippe
Philippe

Reputation: 1179

You can exit(0) in the applicationWillResignActive method of your delegate but it will kill the app if there is a phone call or something. And apple will block it.

Upvotes: 0

user1168492
user1168492

Reputation:

you can try this....

UIApplicationExitsOnSuspend to your Info.plist

Upvotes: 0

Related Questions