Solved

iPhone app development: How to close an application programmatically

Posted on 2009-05-05
3
12,459 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
Comment Utility
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
Comment Utility
You can also use

Code:
exit(0);
0
 

Author Comment

by:ehensens
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of new and distinct gadgets are making their appearance every other day. The latest gadget that has wooed the attention of all gadget lovers and non gadget lovers alike is the Smartwatch. This tiny gadget is capable of offering live access to …
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

762 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

8 Experts available now in Live!

Get 1:1 Help Now