Michael Tsai – Blog – Pasteboard Privacy Preview in macOS 15.4


Apple (via Jeff Nadeau):

Prepare your app for an upcoming feature in macOS that alerts a person using a device when your app programmatically reads the general pasteboard. The system shows the alert only if the pasteboard access wasn’t a result of someone’s input on a UI element that the system considers paste-related. This behavior is similar to how UIPasteboard behaves in iOS. New detect methods in NSPasteboard and NSPasteboardItem make it possible for an app to examine the kinds of data on the pasteboard without actually reading them and showing the alert. NSPasteboard also adds an accessBehavior property to determine if programmatic pasteboard access is always allowed, never allowed, or if it prompts an alert requesting permission. You can adopt these APIs ahead of the change, and set a user default to test the new behavior on your Mac. To do so, launch Terminal and enter the command defaults write EnablePasteboardPrivacyDeveloperPreview -bool yes to enable the behavior for your app.

The Swift and Objective-C APIs are different.

Miguel Arroz:

Long ago when I was still at Apple I filed a radar suggesting something like this when I found out the Facebook iOS app would look into the pasteboard as soon as it was brought forward and suggest posting any URL the user might have there.

This is incredibly hard to get right since there’s no straightforward way for the OS to know if a paste op is legit.

Previously:


12 Comments













We will be happy to hear your thoughts

Leave a reply

Som2ny Network
Logo
Compare items
  • Total (0)
Compare
0