UIPasteboard Access Notice in iOS14 Beta

In iOS14 Beta, we find that a new notice will appear when accessing the pasteboard, every time, e.g. "Alipay pasted from WeChat".

It may not clear, and it's hard to understand.
In addition, some APPs share messages during the pasteboard. And users are used to these functions. Notice may interrupt interaction.

We want to know:
  1. Will this feature be adjusted in release version?

  2. Is this feature optional and how to skip this notice?

Code:
Code Block language
[UIPasteboard generalPasteboard].string;


Thanks.
Answered by Security Engineer in 614434022
The WWDC talk "Better trust through better privacy" introduces this prompt.
Great question! Let me answer whether it's possible to skip the notification.

Whenever your app accesses UIPasteboard data, it will trigger the notification.

If it accesses UIPasteboard metadata however, it will not trigger the notification. Metadata access includes item count and individual item type. Metadata access also includes the new detection API: detectPatterns(for:completionHandler:) and detectPatterns(for:inItemSet:completionHandler:), you can detect certain patterns in data without triggering the notification.

For Seed 1, patterns include .probableWebURL and .probableWebSearch. Let us know if you need more patterns, file a Feedback Assistant request and let us know the number.

Hope that helps.

G.


Accepted Answer
The WWDC talk "Better trust through better privacy" introduces this prompt.
Thanks for your advice.
However, I found that the result from detectPatterns(for:completionHandler:) does not match text I copied.
It is a string like "com.apple.uikit.detected-type.address-bar-search".
I want to read some plain text from the pasteboard without notification.
Except patterns .probableWebURL and .probableWebSearch, will another pattern work for plain text?

Email:****.*@*********.com

Thanks.
detectPatterns(for:completionHandler:) will return the patterns that exist in the first pasteboard item. So if you pass in [.probableWebSearch] and that pattern exists, you will get back [.probableWebSearch].

You cannot in general read plain text from the pasteboard without notification. As explained above, this is data and not metadata, and so will trigger the notification.

G.
I can not the find the documentation for new detection API: detectPatterns(for:completionHandler:) and detectPatterns(for:inItemSet:completionHandler:)。How to get the detail documentation and demo?

Thanks.
I'd love to see 2FA codes added as a pattern to UIPasteboardDetectionPattern. I've filed a Feedback Request at FB7799717.

Thanks for being open to adding more of these!
Is it possible to add a custom pattern to UIPasteboardDetectionPattern, and support regular Expressions detecting.
https://developer.apple.com/forums/thread/652204#652204021

not like before,iOS14 show “noteworthy float window” when getting data from Pasteboard。

It‘s OK to notify user that the app is reading Pasteboard.


iOS14 add new APIs to detect Pasteboard content without showing “noteworthy float window” 

detectPatternsForPatterns:completionHandler:
detectPatternsForPatterns:inItemSet:completionHandler:

but these api only detect simple URL pattern which seems little value or interest for developer;

why not making these apis support Regular Expressions detecting。
if so,app can detect what it really need before read, 
means less Pasteboard reading, 
means less “noteworthy float window” showing, 
means better user experience。
Pattern suggestion: Similar to probableWebURL but only for URLs that match the apps associated domains.

Some apps will copy a universal link from a developers website to the clipboard before sending a user to the app store to have the user install the app. On first run the app will check the pasteboard for the universal link and take the user to the matching "page" in app. In this case the app only really needs the pasteboard for URLs from its associated domain list.

Feedback Assistant: FB7976823


Is UIPasteboard.hasStrings considered metadata? And won't cause the notice to appear?
UIPasteboard.hasStrings is metadata and should not cause the notice to appear.

G.
Similar to @bjtitus I would like to see 2FA codes such as SMS TAN verification as UIPasteboardDetectionPattern
Looking forward!

Specific domain checking would be super helpful.

It would also be helpful to have a pattern for blank-like strings. UIPasteboard.hasStrings returns false if .strings is nil, which is good. But it returns true if it's an empty/non-nil string ("") or whitespace-only. UIPasteboard.hasStrings seems mostly useless in those cases, from a practical standpoint, even though it's technically correct.

Or is there already some way to determine this?

EDIT: For anyone interested, the "probableWebSearch" pattern seems to cover this already. The documentation doesn't state this explicitly, but this pattern seems to match anything that's not blank/whitespace-only.

UIPasteboard Access Notice in iOS14 Beta
 
 
Q