gpt4 book ai didi

ios - 如何以编程方式获取 iOS 上粘贴板内容的来源

转载 作者:行者123 更新时间:2023-12-03 11:16:50 25 4
gpt4 key购买 nike

在 iOS 14 上,当用户在另一个应用程序上复制/粘贴内容时,会显示一条通知,其中包含粘贴板内容来自的应用程序的名称:
On this example, the text is pasted to Notes app from Safari app
是否可以以编程方式获取此信息?
例如,如果用户在 Safari 上复制链接并将其粘贴到我的应用程序中,应用程序是否可以知道粘贴板内容来自 Safari ?
我在 UIPasteboard 或 UIPasteConfiguration 文档中没有找到类似的内容。

最佳答案

似乎没有 API 来获取 owner谁把元素放在 pasteboard .
来自 documentation :

Pasteboard Owner and Items

The object that last put data onto thepasteboard is referred to as the pasteboard owner. Each piece of dataplaced onto a pasteboard is considered a pasteboard item. Thepasteboard can hold single or multiple items. Apps can place orretrieve as many items as they wish. For example, say a user selectionin a view contains both text and an image. The pasteboard lets youcopy the text and the image to the pasteboard as separate items. Anapp reading multiple items from a pasteboard can choose to take onlythose items that it supports (the text, but not the image, forexample).


addItems方法,没有(或者我可能找不到)任何名为 owner 的属性.

关于ios - 如何以编程方式获取 iOS 上粘贴板内容的来源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65882735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com