Solved

iPhone app development: How to close an application programmatically

Posted on 2009-05-05
3
12,506 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 28

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 28

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now