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

Presenting custom Presentr triggered warning message: Warning: Attempt to present * on *whose view is not in the window hierarchy" #155

Open
EllisShen opened this issue Jul 14, 2018 · 0 comments

Comments

@EllisShen
Copy link

Thanks for your attention.

I have a UITabBarController in which contains multiple NotificationCenter listeners. For every listener, I use Presentr as a bottom half modal to notify the user an event occur or a new message is received. I import Presentr from the GitHub repo directly (I figured out that the code of v1.3.2 on Cocoapod has some difference with the latest Github version).

It works fine if I use Presentr with the predefined .bottomHalf config. But when I tried with custom settings like below, it will always trigger a warning message: Attempt to present * on *whose view is not in the window hierarchy", and sometimes it caused the app crashed.

    let presenter: Presentr = {
        let width = ModalSize.fluid(percentage: 0.96)
        let height = ModalSize.fluid(percentage: 0.46)
        let center = ModalCenterPosition.bottomCenter
        let customType = PresentationType.custom(width: width, height: height, center: center)

        let customPresenter = Presentr(presentationType: customType)
        customPresenter.transitionType = .coverVertical
        customPresenter.dismissTransitionType = .coverVertical
        customPresenter.dismissAnimated = true
        customPresenter.roundCorners = true
        customPresenter.cornerRadius = 16
//        customPresenter.backgroundColor = .green
//        customPresenter.backgroundOpacity = 0.5
        customPresenter.dismissOnSwipe = true
        customPresenter.dismissOnSwipeDirection = .top
        return customPresenter
    }()

Do you have any suggestion? I didn't figure out the reason caused this error. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant