UIAlertController popoverPresentationController error: snapshot of an image that was not displayed results in empty snapshots

I have it UIBarButtonItem, and it opens a popover, like this:

@IBAction func openAdmin(sender: UIBarButtonItem) {
    let alertController = UIAlertController(title: nil, message: "Elige una opción", preferredStyle: .ActionSheet)

    // action button initializations... ... ...

    alertController.popoverPresentationController?.sourceView = self.view
    alertController.popoverPresentationController?.sourceRect = sender

    presentViewController(alertController, animated: true, completion: nil)
}

And when I open a popover with this function, I get this warning 4 times:

A snapshot of a snapshot that was not displayed results in an empty snapshot. Make sure your view has been viewed at least once before the snapshot or snapshot after screen updates.

What do I need to do to resolve this warning?

I read a lot of questions with the same warning, but the questions were about the camera or UIImageView, but I do not use the camera either UIImageView. In popover he has only two UIAlertActions

+4
1

. , , layoutIfNeeded currentViewController.

presentViewController(alertController, animated: true, completion: nil)
[alertController.view layoutIfNeeded];
+2

Source: https://habr.com/ru/post/1649969/


All Articles