To show an alert when application just enter into background - iphone

I just want to show an alert when user just quit the application before application entering the background, how can I do that??
If I show the alert in applicationDidEnterBackground:(UIApplication *)application method then this alert will be shown when we again resume the application, but I need to show the alert before the application enters the background.

You can't do this, and rightly so. When the user presses the home button, they go to the home screen. This is a fundamental part of the iOS user experience. Nothing stops the home button working.

applicationWillResignActive and applicationWillTerminate may be of interest to this general question—but you can't present anything into the UI once the home button is pressed. These methods do let you briefly run any critical code however, while the home screen is being presented to the user.

Related

How do I force my ios7 app to start on the home screen?

I have an app with multiple View Controllers. I have a Home screen with "Play / Options / etc.". When you hit Play, you navigate over to the GamePlay View Controller and start playing.
I find that if I'm in the "gameplay" VC and I hit the iPhone's Home button (leaving my app) and then re-launch my app, it puts me right back to the game screen. I'd like to force the app to start on the same "Home" screen every time is it launched.
Suggestions greatly appreciated!
Thanks,
-Ed
in your app's plist add the key UIApplicationExitsOnSuspend and set it to YES.
Your app wont be suspended and youll always start on the home screen
When you press the Home button, the application goes to background. When launched again, application just enters foreground from background. I think you can load the home screen in the following delegate method in AppDelegate
- (void)applicationWillEnterForeground:(UIApplication *)application
You can preserve the state of the game (I don't want to kill that zombie again!) in the following:
- (void)applicationDidEnterBackground:(UIApplication *)application

Present iPhone dial pad with a number but not actually place the call

I know how to open a tel:// URL so that I can launch a call on an iPhone, but I'm wondering if there's a way to just have the phone app launch and wait for the user to press the call button.
Is this possible?
what i do is present a UIAlertView asking for confirmation ... if the user presses Call then i go ahead with the request... If he presses Cancel the app does nothing other than removing the alert view from screen ...

IPHONE - How to make a disclaimer?

my app is almost finished and since is for airline pilots I would like to add a disclamer (like an alert view...but more like a scroll view) that pop up as soon as they start the app and if they don't press ok I want to exit from the app. Any advice would be really appreciated.
thanks
Just use a UIAlertView — if you put a lot of text in it, it automatically scrolls.
If the user presses the "No" button, you need to just disable the app rather than exit — apps aren't allowed to exit unless the user presses the home button. You could pop up a modal view controller (with no way of dismissing it) with a message saying that the app cannot be used until the disclaimer is read and accepted.

iPhone Application Should Close, not go to Background

I have an application wherein when the user taps iPhone's central button, the application is sent to background, but I want it to be closed.
I can hand event and close it, but may be there is some configuration setting to deny running in the background?
Thank you
If you want your app to terminate when the user presses the home button, set the value of UIApplicationExitsOnSuspend to YES in your app's Info.plist file. If you do this, when the user taps the home button the applicationWillTerminate: method of your app delegate will be called and then your application will terminate.

Preventing an app from exiting immediately?

How can I prevent an application from exiting immediately? If the user press the home button while the application is saving a picture to the photo album, only a part of the picture is saved!
Thanks!
You can't. You can put code in your App Delegate's
- (void)applicationWillTerminate:(UIApplication *)application
Function to attempt to quickly finish saving the picture and notify the user that they prematurely quit the application, but there's nothing you can do to prevent a user from pressing the home button and quitting your app.