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.
Related
I am facing a weird issue with UIAlertController.
On approval/rejection of a ticket, an alert is presented like below
When alert first appears
If the screen gets locked on this page and we reopen the phone, then because of re-auth everytime app becomes active, we see the following screen.
when auth screen is presented over alert
If the pin is put now, and app opens, the alert control occupies a buggy position at the top like this.
when auth is done and alert screen appears
This is mainly because the auth screen was presented over alert control and everytime another control is presented over alert, this same bug re-appears.
I have read that addUIInterruptionMonitorWithDescription could be used to accept / tap on a particular button in a system alert. On recently trying some test code out, I was doing the following:
Adding a Photos Alert
Adding a Calendar Alert
Adding a Location Alert.
On the simulator, I was surprised to find that the Calendar and Location prompt automatically had their "Allow" buttons tapped. For the Photos prompt, the "Don't Allow" was hit. My question is - is there no need for addUIInterruptionMonitorWithDescription anymore? I tried using it for tapping on the dialogs but it didn't do anything. Even when I tried to hit another button on the alerts, I didn't see it working. How do I tap on the individual buttons on a system alert her?
If there is an alert on screen, and none of your interruption handlers handle it, XCTest will dismiss it for you if you are using Xcode <9.1.
To gain control of the alerts, you should create an interruption handler for each alert, returning true from the closure when (and only when) you have handled the alert that handler was intended for.
If the test tries all your alert handlers or receives a true return value from any of your handlers, and there is still an alert on screen, XCTest will handle the alert itself.
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.
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.
During an active VOIP call, my app is put into the background when an incoming cellular call is received and answered. If, while on the cellular call, I bring my app back to the foreground the app view appears but is unresponsive. The "Touch to return to call" banner appears at the top of the view in green but the app view appears as if there is a darker transparent window overlaid on top of it preventing the view from receiving input. If I put my app into the background, bring another app to the foreground and then bring my app back to the foreground everything works as expected so the problem seems to be specific to active cell calls and/or the green banner only? In Settings->Notifications->Phone I tried turning Notification Center OFF and Alert Style NONE in the hopes of removing the banner to see if the problem still exists but these settings do not effect that banner. In addtion to the App window appearing to have a transparent window overlaid on it, if I touch the window I'm able to drag the entire app window (or view) in all directions (up down side to side) and it has a bounce effect (like tableview vertical scroll) when I release it.
If I dont know the problem I cannot fix it (:
Thanks..
Are you sure there's no view being added on top your view which might be intercepting all your events? My second guess would've been that your app received a memory warning and unloaded a bunch of views. However, that's not very likely since you still see all the views.
I don't know what you really mean to "bring your app back to the foreground",but I can tell you for sure that you cannot call in the same thread the UI and the incoming call, so for situations like this when you want to render some view during a call you can try something like this:
public void InvokeGUIThread(Action action)
{
Dispatcher.Invoke(action);
}
For example if you want to set a text in a textblock do something like this:
InvokeGUIThread(() =>
{
textBlockSome.Text = e.Item.ToString();
});