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

AlertController not showing up with warning: Attempt to present UIAlertController on UINavigationController whose view is not in the window hierarchy! #120

Open
sandeepbol opened this issue May 15, 2018 · 1 comment

Comments

@sandeepbol
Copy link

I am notifying Armchair of a significant event from a callback of a async request as follows

func onTransactionCompleted(status: TransactionStatus) {
  if (status == .success) {
      DispatchQueue.main.async {
        Armchair.userDidSignificantEvent(true)
      }
  }
}

but Alertcontroller is not shown and debugger shows

warning: Attempt to present UIAlertController on UINavigationController whose view is not in the window hierarchy!

@sandeepbol
Copy link
Author

I got around the issue by moving Armchair.userDidSignificantEvent(true) to viewDidAppear:

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        if canShowRatingPrompt {
            Armchair.userDidSignificantEvent(true)
            canShowRatingPrompt = false
        }
    }

But will be happy to hear what might be more clean and best approach.

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