Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<_UIPopoverBackgroundVisualEffectView> is being asked to animate its opacity

I am trying to show an (AlertController) Action sheet. But I am getting this waning in console " <_UIPopoverBackgroundVisualEffectView 0x7fd65ef76ec0> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1. "

here is my code :-

extension GroupDataView {

  func callDot (sender : UIButton)
  {
      let alert = UIAlertController(title: nil, message: nil,
                                  preferredStyle: .actionSheet)

      alert.addAction(UIAlertAction(title: "Edit Group", style: .default , handler:{ (action)in
        print("User click Edit Group")
      }))

      alert.addAction(UIAlertAction(title: "Create Folder", style: .default , handler:{ (action)in
        print("User click Create Folder button")
      }))

      alert.addAction(UIAlertAction(title: "Delete Group", style: .destructive , handler:{ (action)in
          print("User click Delete Group button")

      }))

        if let popoverController = alert.popoverPresentationController   {
          popoverController.sourceView = sender
          popoverController.sourceRect = sender.bounds

          self.present(alert, animated: true, completion: {
            print("completion block")
          })
       }

      else
      {
          self.present(alert, animated: true, completion: {
              print("completion block")
          })
      }
  }
}  

I don't know why this warning is showing in console. ActionSheet is coming properly but how to remove that warning? Thanks

like image 369
Kishor Pahalwani Avatar asked Jan 11 '17 11:01

Kishor Pahalwani


2 Answers

iOS Bug

See answer by @Hardy on Apple Developer Forum: Warning message from UIPopover

... seems to be a bug in iOS. But it does not seem to be critical. Though - I believe - that sometimes the area below the UIAlertController is not correctly drawn. I can see for a short period of time a black background flashing although the background of the underlying view is not black.

Cached on Google here

like image 72
SwiftArchitect Avatar answered Nov 15 '22 01:11

SwiftArchitect


I had the same problem, and I resolved it by setting animated: false in self.present or/and self.dismiss function. See the last comment in https://forums.developer.apple.com/thread/53677

like image 33
Syngmaster Avatar answered Nov 15 '22 02:11

Syngmaster