Pasteboard alert on iOS 16
sdtaheri opened this issue · 7 comments
I don't know but will look into it.
Thanks. These are the changes:
https://sarunw.com/posts/uipasteboard-privacy-change-ios16/
Here is the culprit in code. It reads the data
and string
everytime and causes the alert to pop up continuously.
//...
} else if pasteboard.contains(pasteboardTypes: ["public.html"]) {
if let data = pasteboard.data(forPasteboardType: "public.html"), String(data: data, encoding: .utf8) != nil {
// We have HTML, which we will have to sanitize before pasting
return .Html
}
} else if pasteboard.string != nil {
// We have a string that we can paste
return .Text
}
//...
It hits the aforementioned block of code when checking canPerformAction
for Paste
and Paste and Match Style
menus in MarkupWKWebView.swift. I believe fetching the pasteboard value should only be done when those menus are explicitly performed.
Thanks for the details. I was out of town but will take a look this week. I was not sensitized to it because I am primarily using it on a Mac and using Ctrl-C/Ctrl-V.
Thanks again for raising the issue and for the debugging to locate the problem!
@stevengharris Thank you for resolving it this fast.
I still get this all the time when selecting text... am I missing something?
It shouldn't be happening if you are using main
. Does it happen in SwiftUIDemo?