UIPasteboard permission dialog disappear immediately if paste from universal clipboard

I was trying to copy and paste from my mac laptop to iPhone while using UIPasteboard. The permission dialog popped up for less than 1 second and disappear. If using UIPasteboard again, the dialog will stay.

If copying locally without using universal clipboard, the permission dialog will stay.

I made a workaround to display the permission dialog again after the first dialog disappears:

if UIPasteboard.general.hasStrings {
                 
    // A workaround for the issue that the permission dialog disappear
    // immediately while using universal clipboard
    if #available(iOS 16, *) {
        if let str = UIPasteboard.general.string?.prefix(8) {
            self.regCodeTextFieldModel.text = String(str)
        }
    }
                 
     if let str = UIPasteboard.general.string?.prefix(8) {
         self.regCodeTextFieldModel.text = String(str)
     }
}

Does anyone have a better solution to this issue?

Its actual for me too, i can't understand why, but sometimes its disappear, sometimes not

UIPasteboard permission dialog disappear immediately if paste from universal clipboard
 
 
Q