App Screen Goes black when tap on UIAlertAction - ios

I am working on existing swift app written in Swift 4.0. I am getting strange issue in any of screen If I tried to use UIAlertController with UIAlertAction in form of alert or action sheet. As soon as I tap on UIAlertAction Button complete screen goes black(Blank) and I need to force quit to restart app, I am getting this on iOS 14.7.1....
I tried to use alert on Main Thread, added scene delegate as well as Deployment target is iOS 13.0 But no luck and interesting part is If I run app with Xcode everything works fine but if I tried to use app on device directly without run, getting this strange issue....Any Suggestions...
Thanks in advance....

I got solution for now, after seeing Debug View Hierarchy I got on tap of UIAlertAction, it remove window that's why complete app goes blank, So I created new window for showing Alert. I followed this stack OverFlow Answer Every UIAlertController disappear automatically before user responds - since iOS 13
May be it helps someone....

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.

Watch App terminates upon deactivation if WKAlert is being shown

I'm creating a watch app and I'm noticing that "Program ended with exit code: 0" is shown in the debug window if the watch app is deactivated (via cmd+shift+h, lower wrist, etc). The code I'm using to present alert in the WKInterfaceController is:
presentAlert(withTitle: alert.title, message: alert.message, preferredStyle: .alert, actions: [cancelAction, continueAction])
I'm trying to understand why the watch app is closing with no error if a wkalert is visible and active on the screen. The memory of the app is under 20mb and doesn't spike at all when the alert is shown. On every other screen the app simply deactivates. Maybe there is a workaround? Any help would be appreciated.
Thanks - Ross
I reported this bug to Apple:
Summary:
Displaying an Alert will crash App (code 0) if Alert is presented and home button is pressed while displaying a modal view.
Steps to Reproduce:
Display a modal view on Apple Watch then display an Alert. Taping Home button or when screen goes blank the App will crash with Code 0. With attached file tap the Modal button then the PopUp button then on simulator press cmd-shift-H or on watch allow screen to go blank. App will crash with Code 0.
Expected Results:
App should not crash. Displaying with Push segue style instead of Modal will not cause crash.
Actual Results:
crash with Code 0
Version:
iOS 3.0 and iOS 3.1
After reporting this bug to Apple they responded but I am unable to provide the log feedback they requested:
This is a follow-up regarding regarding Bug ID# 29131322.
Engineering has requested the following information in order to further investigate this issue:
Could we get a sysdiagnose from the Watch right after the crash?
Thank you.
Please provide your response or results by updating your bug report and compress any bundled files (e.g. nested folders) prior to uploading.
watchOS sysdiagnose Instructions:
https://developer.apple.com/services-account/download?path=/iOS/watchOS_Logs/sysdiagnose_Logging_Instructions.pdf
watchOS Logging Profile:
https://developer.apple.com/services-account/download?path=/iOS/watchOS_Logs/watchOS_logging.mobileconfig
If you could provide the log feedback and attach it to bug report 29131322 that might help get it fixed.

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

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.

how to hide splash when the app is coming back from background?

I just set the 'Application does not run in background' parameter of my ios app to NO and I added the relevant refreshes in applicationDidBecomeActive: in my application delegate then it works pretty well. But when I switch back to my app, the splash screen still appear during one second. How to remove it and display directly the app ?
I though it was impossible, but it remembered me this topic : Prevent Splash Screen from showing after returning from background
It seems to include an answer to your question...
Also, don't forget to try on the device, sometimes the simulator does weird things.

iOS restore state issue

I recently upgraded my old iPhone app and the new state restore iOS 3/4 feature has introduced a problem. I don't know the name of this restore state feature - what is it called?
Here is my problem scenario:
I navigate into a detail screen on my app. I click a button to navigate to an address and it launches google maps as expected. Then I launch my app again. It briefly shows the last screen I was on, but immediately launches the google map again.
What I want is to simply restore the detail screen that I was last on.
Any hints?
thanks
It is called multitasking, and it is built in automatically when you build under iOS 4.0+. Without you posting any code, it is tough so say, but why don't you put a breakpoint at the line that redirects to Google Maps and see what is calling it. Then you can backtrack to see why it is being called on the reopening of the app.

Resources