Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ruffurs

macrumors newbie
Original poster
Aug 22, 2008
2
0
Hello!

I want to prevent application terminate when the user press Home Button. I want that application does nothing, whene the user press the HomeButton.

I can output message in Console like this:

- (void) applicationWillTerminate(UIApplication *)application {
NSLog(@"Msg");
}

but i did not find how to cancel the application termination on iphone sdk. The method
- (NSTerminateReply) applicationShouldTerminate:(NSApplication *)application {
return NSTerminateCancel;
}

of course, is not working on IPhone SDK.

Is there any similar method on iphone sdk?

[Edited:] This software will be used on IPod Touch. There will be a lot of users, and they are supposed to use only one application.

Thanks.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Actually, that device (in this case, IPod Touch) will not be users, it will be mine.

Well, whilst I understand why you might want to force them into using only your app there is no way to do this directly with in the SDK.

The best suggestion I have it is to subclass UIApplication and override the terminate method (see my posts here for a likely method to override) to not actually terminate the app.

The issue would obviously be that unless you leave yourself some sort of backdoor you won't be able to terminate the app without force-rebooting the iPod either...
 

Luke Redpath

macrumors 6502a
Nov 9, 2007
733
6
Colchester, UK
A few points:

* As you might expect, such a function doesn't exist...
* ...nor will it ever exist.
* What you are trying to do is stupid
* Even if such a function existed, you could not prevent people from force-quitting by holding down the home button...
* ...or rebooting the device (because you can't auto-run apps).

How about you trust your users? If this isn't an option, then an iPhone/iPod Touch is probably not a suitable solution for whatever you're trying to do.
 

grimjim

macrumors member
May 24, 2003
75
0
I think I can understand what you're trying to do: I often find myself signing for deliveries on Windows-Mobile-based devices that presumably only run the "sign-for-deliveries" app.

The iPhone can't be closed down like this using the SDK, I'm afraid. If you need to deploy an app in such a manner that your users cannot quit it or switch to another, then I'm afraid that the iPhone is not going to be the right device for you.
 

tskoti

macrumors newbie
Nov 5, 2008
6
0
how to display alert when home button pressed while app is Running

Hi,

Please let me know, how to display an alert message when home button is pressed on the Iphone while the application is Running


Thanks in Advanced,
koti
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.