Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how to close application using command

Hello all,
I am doing coding in cocoa touch.I want to close my application using command(syntax).I am see different command close,stop but it is not working.
Actually i want to put button for that.when i press this button then application close.

thank you.

Other OS

Posted on Sep 28, 2008 10:33 PM

Reply
7 replies

Sep 30, 2008 1:41 AM in response to diyora

Exit should work, but Apple strongly discourages the use of this method. It should only be used in extreme conditions such as low memory conditions upon starting your application etc.. You should popup a message before calling exit with an reason why.

If you programatically exit your problem then it just vanishes, the transition animation does not appear and the user will look confused unless you tell them why you're exiting.

Nov 27, 2008 11:12 PM in response to gilesjuk

UIApplication *app = [UIApplication sharedApplication];
SEL selector = @selector( terminate );

if ([app respondsToSelector:selector] )
{
id result = [app performSelector:selector];
}

This code will help you to exit the application, for more details refer NSObject, (performSelector), you can get what you expect. 🙂

how to close application using command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.