UIAlertView is not shown when returning from sleep mode in iOS app - ios

My app must sometimes show an UIAlertView when the Home button or the locking button is pushed or when the notification center is shown.
I show the Alert from the applicationWillResignActive delegate's method and everything is ok when home button is pushed or when notificacion center is shown. But there is a problem if the button which is pushed is the locking button (on/off button).
In that case, the Alert is not shown when I return to the app (if I used the Home button it is there). I don't do anything else in other AppDelegate methods which are executed. Also, then, when I show a new Alert (any Alert in the app) the Alert which hasn't been shown when I returned is shown after I dismiss the new one.
Please, could anybody help me?
Thanks in advance.

THE EASY, GIVE ME REP ANSWER:
When the app is put into the background, the app is suspended. Part of this process is closing open alert views.
THE I ACTUALLY KNOW WHAT I'M TALKING ABOUT ANSWER:
The logic behind this is that when the user hits the home button when an alert is displayed, they might be going to look for information on how to answer the alert. However, when the sleep button is pressed, the user has stopped using the device altogether. Apple knows that if they unlock thier device again 3 hours later and see something like Confirm Deletion, they will have absolutely no idea what they were just doing and what to do now.
This is known to cause a serious condition known as what-in-the-world-am-I-supposed-to-do-now-itis. Symptoms of this condition include hitting the round button at the bottom of the screen and subsequently holding on your app icon until it jiggles. They then hit the little 'x' button. This is not good for developer's pockets.

Related

Hide the screenshot in multitasking switcher only in particular cases

Chase bank's iOS app is showing blank view hiding apps details when double tap the home button from the app. And when you login inside the app and touchID alert appears the apps view is not hidden by blank view.
So far I can hide app details by showing image loaded on applicationWillResignActive but it makes app hide it's details while touchID alert comes up.
I've checked similar questions on SO like this or this. Also here. But there is no answer to my question. How to replicate Chase bank's app behavior? How not to hide app details with touchID alert, but have them hidden when double tapped the home button?
I know it's an old question but couldn't find a valid answer to this exact question. So here's my solution.
steps:
create a instance variable for blocker view
init blocker view only once when it's necessary (I did it on applicationWillResignActive)
add blocker view as subview to the window at applicationDidEnterBackground
remove blocker view at applicationWillEnterForeground
The app delegate's applicationWillResignActive is the right place where you put a black or whatever view you want to show when the app is being moved to background. You need to add the desired UIView on Window object. Also you need to remove that view when the app becomes active again.

iOS Multitask App Switcher Custom Image

im developing an iOS App and i would like it to behave like PayPal when the user double taps the home button.
For those who dont know the PayPal app displays a custom image when the app is displayed on the multitask switcher but it doesnt when a notification arrives or when the user pulls the notifications bar.
My issue comes when implementing this, im using the event applicationWillResignActive to display my custom image (as applicationEnteredBackground is not called for this). But this method is called on events on which i dont want the app to display the image (such as notifications, calls, pulling the top bar, etc).
Is there any way of setting this image only when the home button is double tapped?
Thank you!
From what I see, PayPal doesn't cover the viewport with a custom image immediately – when I double tap the Home button, it remains rendered normally until I do something else – but most probably on applicationDidEnterBackground:. After switching to Home screen or another application, the PayPal preview becomes covered.
On the other hand, my mobile banking application does that immediately when applicationWillResignActive: is triggered.
These are AFAIK the only two approaches you can achieve.

Delaying application while UIAlertView is active

I added an Alert view, asking for user input, at the start of my app. The app works fine without the Alert view. But with the code for the Alert view added, part of the UI is blacked out after hitting the 'ok' button on the alert.
I'm not well versed in ios, but is there a good way to delay the app from running until the Alert (text input) is completed (ok button pressed). This might avoid whatever is causing the screen to go black in one section. Apparently the app is executing while the alert is active, and the alert is affecting the UI. Basically, I am asking the user to input their phone number via an alert that will be used later in the app.
When alert view is shown on screen, getting back ground dimmed (reduced alpha) is a normal thing and is practiced by iOS.
However, if you feel some part of the code you want to run only on tap on OK button on alert, move that method call to OK button action handler.

Should touchID be displayed if app minimized

Im implementing touch ID to "unlock" my app, and im not sure if ive run into an apple bug or something i need to handle myself. If i tap the Home button and minimize my app before evaluatePolicy can load the Touch ID prompt, it appears over the home screen.
![not enough reputation to display screenshot, so heres a link]https://www.dropbox.com/s/zrhc60lx87ze7mt/IMG_0016.PNG
Successful/failure/cancel evaluation of this policy does nothing, but when i re-enter the app and cancel it again, touchID seems to be disabled forever until i restart the phone.
Anyone else running into this issue or have an ideas?
P.S. Theres an open radar where errSecUserCanceled is never returned from a cancel button tap, so right now i fall into my errSecAuthFailed case, which could also be the cause.
Answer is no. It should not be be displayed, when minimized.
The problem is IMHO that the code segment is being called again from your app when it goes to the background. For example loadView , didLoad and so on.
Try moving the code, that calls the authentication somewhere else in the program (different method).
For example, if your code uses a textView to enter password, you can implement the authentication within keyboardWillShow or similar.
Hope it helps.

Prevent application from entering background, requiring a code to close app

I would like to add functionality to my iPad app such that, when the home button is pressed and my app is about to enter the background, a message box pops up requesting a code. Only if the correct code is entered will the application go into the background, otherwise the app will not close.
Is this possible?
Short answer, no it's not possible.

Resources