Skip to content
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

Main Thread Checker throws Error in Xcode 9.2 #194

Closed
Ruckt opened this issue Dec 21, 2017 · 12 comments
Closed

Main Thread Checker throws Error in Xcode 9.2 #194

Ruckt opened this issue Dec 21, 2017 · 12 comments

Comments

@Ruckt
Copy link

Ruckt commented Dec 21, 2017

  • Xcode version (e.g. 9.1): 9.2
  • PopupDialog version (e.g. 0.5.0): latest
  • Minimum deployment target (e.g. 9.0): 10.0
  • Language (Objective-C / Swift): Swift
  • In case of Swift - Version (e.g. 4): 4
  • Dependency manager (e.g. CocoaPods): yes
  • Version (e.g. 1.3.1): yes

When presenting the popup, the first time it is presented after pressing a button, I get the following logs in the console: First: Warning: Attempt to present ... viewController.... whose view is not in the window hierarchy!

Then:

Main Thread Checker: UI API called on a background thread: -[UIView layer]
PID: 10924, TID: 3479577, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 21
Backtrace:

This issue persists even when wrapping everything in DispatchQueue.main.async { .. }.

After doing some research, seems like you may have some updating to do as mentioned here:
https://stackoverflow.com/a/44392584/5912335

Or is there another solution?

@mwfire
Copy link
Member

mwfire commented Dec 21, 2017

Hey @Ruckt,
do you see these problems with the example project of PopupDialog as well?

@Ruckt
Copy link
Author

Ruckt commented Dec 21, 2017

No, I don't get it when trying out your sample project. It seems to be in certain situations only - the first time I press the button it will print out these errors but not subsequent times. In looking up the error, I saw solutions for moving things to viewDidAppear instead of viewDidLoad - https://stackoverflow.com/questions/26022756/warning-attempt-to-present-on-whose-view-is-not-in-the-window-hierarchy-s - but I'm presenting things on a button press after loading is complete, so that didn't apply.

@mwfire
Copy link
Member

mwfire commented Dec 22, 2017

We are talking about 2 separate issues here:

  1. view not in window hierarchy
  2. UI API called in background thread

Is it possible to wrap this up in a tiny, separate project that showcases these errors and share it here? I am not sure any of these is related to the dialog, but let’s find out!

@Ruckt
Copy link
Author

Ruckt commented Dec 22, 2017

Creating a separate project may be a problem. I paused on warning issues and took a screenshot of it. Would this help you?
screen shot 2017-12-22 at 11 30 08 am

@Ruckt
Copy link
Author

Ruckt commented Dec 22, 2017

I found I had the same issue with another pod. I put that line on the main thread and it eliminated the problem. The blur layer is a return line in a getter and i've forgotten a bit of my obj-c so it wasn't so easy to wrap it in a dispatchQueue so I couldn't test it. But if you can tell me how to do it and I can test it out for you - or maybe you want to create a fork....we can test it out that way.

@mwfire
Copy link
Member

mwfire commented Dec 23, 2017

Do you have liveBlur enabled? FXBlurView is going to be replaced with upcoming dialog versions.

@Ruckt
Copy link
Author

Ruckt commented Dec 23, 2017

Yes, how does that contribute?

@mwfire
Copy link
Member

mwfire commented Dec 24, 2017

Hey there. Not sure yet, just trying to narrow it down. Of course, the subsequent question would be if you see the same problem also with live blur disabled...

@Ruckt
Copy link
Author

Ruckt commented Dec 26, 2017

So yes, if I disable live blur, I no longer get that warning.

@mwfire
Copy link
Member

mwfire commented Dec 27, 2017

Ok, so until FXBlurView is replaced, this will not be fixed. :( Solution for now is to keep liveBlur disabled. However, if you want to investigate, it would be great to have a PR for this!

Thanks!

@mwfire
Copy link
Member

mwfire commented Jan 6, 2018

FXBlurView was replaced with DynamicBlurView with the latest development version and can be tested on the development branch. Just change your pod file to pod 'PopupDialog', :git => 'https://github.com/Orderella/PopupDialog.git', :branch => 'development'

Please report any findings here. Thanks for testing 👍

@Ruckt
Copy link
Author

Ruckt commented Jan 6, 2018

Sorry I won't be of any more help on this one. My project for this client finished and I had to delete the code.

@mwfire mwfire closed this as completed Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants