UIPasteBoard's privacy change in iOS 16

⋅ 2 min read ⋅ iOS iOS 16

Table of Contents

Before iOS 14, any iOS app can access pasteboard data without user consent.

This is scary since we copy a lot of information daily, e.g., Password, Bank account, and Code from StackOverflow.

The fact that any app can access these pieces of information without us even noticing is terrifying.

In iOS 14, Apple made us aware of this by showing a banner when an app tries to access this pasteboard/clipboard data.

Here is how the banner look like.

Pasteboard banner in iOS 14.
Pasteboard banner in iOS 14.

The banner is a nice improvement. We can stop using malicious apps before bad things happen. But this approach still has a fall.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

The problem with pasteboard Notification

The problem with this approach is even though we know an app is reading our pasteboard, nothing we can do about it.

The app already got access to our data. We are just aware that it happened.

UIPasteBoard's privacy change in iOS 16

In iOS 16, Apple allows users to grant or deny pasteboard reading permission before it happens.

This is similar to other privacy permissions like location.

Users will be prompt with the following alert when an app tries to access the pasteboard data.

Pasteboard permission prompt in iOS 16.
Pasteboard permission prompt in iOS 16.

Behaviors

The choice you made won't remember like other permissions (At least in the current beta).

Here are the behaviors of the new pasteboard privacy from my observations.

  1. If you allow it, the popup won't show again.
  2. If you don't allow it, the popup will show again when the app tries to access a pasteboard data.
  3. This permission won't show in the app's privacy settings like others. So there is no way to control it once allowed.
  4. I don't know how long the system remembered the allow permission. In my test, the prompt will reappear when I rebuild the app, so the permission might get reset for every app update.

How to access pasteboard data without getting permission dialog

Apple showing the dialog only when an app is trying to access a pasteboard data without user intention.

The system won't show the permission dialog if it knows that users explicitly paste the data themselves.

There are three ways to avoid this prompt appearing in your app.

  1. Users intentionally paste it via an options menu (Long press on a text field).
  2. Users use keyboard shortcut (Command+V) to paste on a hardware keyboard.
  3. Use new UIPasteControl which introduced in iOS 16. UIPasteControl is a standard control for pasting a value from the pasteboard.

Here is an example of UIPasteBoard control, which you can configure its appearance.

UIPasteBoard control.
UIPasteBoard control.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Conclusion

I think this is a nice change, but I'm not sure I like the implementation.

I think it should be the same as other privacy permission.

  1. It should have a proper privacy control where you can turn it on/off.
  2. It should have a proper description in Info.plist.
  3. It should have an indicator or keep the same banner when the pasteboard got accessed.

Read more article about iOS, iOS 16, or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Buy me a coffee Tweet Share
Previous
Better way to get paths to system directories in iOS 16

In iOS 16, the URL got a whole pack of type properties that reference a different path within a user domain, e.g., URL.documentsDirectory.

Next
New way to control number of lines of SwiftUI Text in iOS 16

In iOS 16, we got a big improvement over lineLimit modifiers. Let's see what we can do with it.

← Home