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
I had the same problem, and I resolved it by setting
animated: false
inself.present
or/andself.dismiss
function. See the last comment in https://forums.developer.apple.com/thread/53677I realise this is an old question but I was just faced with the same issue and I found a workaround by delaying the presentation by 0.001 seconds so when you normally call this function I used this code for the delay
Please excuse the OBJ-C but a similar delay in swift should have the same result of not displaying 2 views at the same time.
iOS Bug
See answer by @Hardy on Apple Developer Forum: Warning message from UIPopover †
† Cached on Google here