New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popup dialog doesn't appear when app is in background #140
Comments
I tried debugging this issue. PopupDialog's When I tried simulating the same scenario i.e. presenting a view controller (lets say VCB) from another (VCA) when the app was in background, it works as expected. VCB is present on screen when app comes in foreground. |
Hey there! Phew, that's a tricky one. It actually should be avoided to do UI updates when the app is in background, this can lead to weird side effects. Does this work with UIAlertController? |
Hi Martin, The behavior with UIAlertController is the one that I expected: Just one thing that's interesting though. As timer to show |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@mwfire , This issue still exist and can be easily reproduced. When coming back to foreground you can see the PopupDialogVC just for a 1/100 sec and it disappears and when you use memory graph, you can see that the instance of PopupDialogVC is still in the memory even though it isn't visible. Did you also check memory graph for that zombie instance @tushargarg ? We should come up with a solution for this ASAP because the use case of an async request -> user goes into background -> user comes into foreground after a while is a common behaviour. |
Hey there! Thx a lot :) |
Sure @mwfire, basically the issue is when doing a server async request. Inside the PopupDialog example project:
and once you tap on the Show Image Dialog button, tap the home button, wait a few secs and open the app. You will see that the alert shows for a 1/100 of a sec and disappears. In contrast, create a new storyboard with an empty ViewController and replace the below code:
Do the same use case, tap the home button and open the app after few secs and you will see that the Please let me know if anything isn't working as explained. Thanks! |
Hey there, can you do me a favor and give it a shot with disabling animations when the app is in background, something like this func doBackgroundWork() {
let url = URL(string: "https://pastebin.com/7F1cQbqM")!
let task = URLSession.shared.dataTask(with: url) {(data, response, error) in
DispatchQueue.main.async {
self.showImageDialog(animated: UIApplication.shared.applicationState == .active)
}
}
task.resume()
} Does that work for you? |
It sure does. I've tried everything besides that.. Thanks again! |
@OhadMaor-VIA, ok cool. So we pinned it down to animation collision when the app comes to foreground. I will see if it can be added to the library. |
Hey @mwfire
Should be replaced with:
|
I opened PR with the fix. It will be great to get it with a new version asap. |
Included in Thanks @ivulyov90 |
Thanks for this library. It's pretty useful. Here is the bug I am facing:
Report
Environment
Please provide information on your development environment, so we can build with the same scenario.
Dependency management
If you are not using any dependency managers, you can remove this section.
What did you do?
Present a popup dialog when app is in background.
This was first observed when a network call finished when app was in background.
Second time to simulate it, a timer was used to fire when app was in background.
What did you expect to happen?
When app comes back to foreground (appWillEnterForeground:), popup dialog should be present
on the screen.
What happened instead?
Popup Dialog was not present on the screen.
Project that demonstrates the issue
Let me know if this is needed, I will upload one.
ℹ In complex cases, it might be useful to link to a sample project. If you don't provide an example, you can delete this section.
The text was updated successfully, but these errors were encountered: