Solved

iPhone app development: How to close an application programmatically

Posted on 2009-05-05
3
12,593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

739 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