Solved

iPhone app development: How to close an application programmatically

Posted on 2009-05-05
3
12,563 Views
Last Modified: 2013-11-25
Hi all,

I need to close an app programmatically and I am doing so with the code attached.

I am getting this warning, however:

"Warning: 'UIApplication' may not respond to '-terminateWithSuccess'
(Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)"

Now, the code works just great, but how can I get rid of these warnings?
[[UIApplication sharedApplication] terminateWithSuccess];

Open in new window

0
Comment
Question by:ehensens
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
chilternPC earned 500 total points
ID: 24308377
from another post....

Use this to remove the compiler warning:


[[UIApplication sharedApplication] performSelector:@selector(terminateWithSuccess)];


Of course if Apple change this private API this will stop working.
0
 
LVL 29

Expert Comment

by:chilternPC
ID: 24308407
You can also use

Code:
exit(0);
0
 

Author Comment

by:ehensens
ID: 24308427
The reason I can't use exit(0) is because I have a settings bundle and if I update the settings bundle and exit(0) the new updates don't get saved. But, if I terminateWithSucess, the settings do get saved.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Apple iTunes - Move from PC to PC First login to your old PC 1. Click on File. 2. Then click Library. 3. Now open the Export Library. 4. Save the .xml file to your desktop. This file will hold all of the information about your playl…
Thanks to luck and dedication (hitting refresh every 5 seconds when the pre-orders were going live at midnight on April 10th) I managed to actually receive an Apple Watch on release day, April 24th. Which means I’ve been using it daily for just ov…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question