- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我目前正在开发一个包含共享扩展的 iOS 应用程序。
我意识到NSExtensionActivationSupportsImageWithMaxCount
key 不允许我在 Safari(即:imgur 链接)下激活 .jpeg 或 .png URL(“public.image”UTI,kUTTypeImage)上的共享扩展。
如果我切换到 NSActivationRule = TRUEPREDICATE,我仍然可以激活和测试我的扩展,但它被禁止用于已发布的应用程序。
我在雷达上填写了一个错误,以防万一它不需要(甚至 facebook、twitter 等...都没有在此 URL 上激活)
现在,我想将以下键和“public.image”组合在一个 NSPredicate 字符串中,如文档所述 (https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW8)
所以我必须将 key 转换为 UTI
到目前为止我已经翻译了:
- NSExtensionActivationSupportsFileWithMaxCount
到“public.file-url” kUTTTypeFileURL
- NSExtensionActivationSupportsMovieWithMaxCount
到“public.movie”kUTTypeMovie
- NSExtensionActivationSupportsText
到“public.text” kUTTypeText
- NSExtensionActivationSupportsWebURLWithMaxCount
到“public.url” kUTTypeURL
但我找不到类型翻译:
NSExtensionActivationSupportsWebPageWithMaxCount
,“public.HTML”是 kUTTypeHTML 吗?有人已经在谓词中使用了这个键吗?
最佳答案
我最终做的是 1) 暂时允许 TRUEPREDICATE,并使用类似这样的逻辑`
NSExtensionItem *item = extensionContext.inputItems.firstObject;
if ( item )
{
NSItemProvider *itemProvider = item.attachments.firstObject;
if ( itemProvider )
{
NSArray *registeredTypeIdentifiers = itemProvider.registeredTypeIdentifiers;
NSLog( @"registeredTypeIdentifiers: %@", registeredTypeIdentifiers );
}
}`
这将为您提供要共享的文档的所有类型(例如:“public.url”)。由于有多种类型,我的谓词变得有点复杂:
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
(
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg-2000"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.tiff"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.compuserve.gif"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.microsoft.bmp"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.microsoft.word.doc"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.openxmlformats.wordprocessingml.document"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.comma-separated-values-text"
)
AND
(
NOT ( ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.photoshop-image" )
)
).@count == $extensionItem.attachments.@count
).@count == 1
这基本上会查找图像(adobe psd 除外)、pdf、txt、csv 或 doc/docx 的任何文件类型。它还只允许一次共享 1 个文档。
看起来 kUTTypeImage 包含 PSD - 因此我阻止了该格式(“com.adobe.photoshop-image”)。
关于iOS AppExtension : How can I Combine NSExtensionActivationRule and NSPredicate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26218627/
我想使用 Haskell 的 parsec 库来实现这个语法规则: ((a | b | c)* (a | b))? 这是一个接受可选(即可能为空)字符串的解析器规则。如果它接受的字符串不为空,则可以通
Python 的 itertools.combinations() 创建的结果是数字的组合。例如: a = [7, 5, 5, 4] b = list(itertools.combinations(a
I found a good script for the permutation of lists, combining and not combining list position on
我正在使用 Beam 管道计算流式数据的电话号码频率。我使用的滑动窗口每 5 分钟重复一次,总周期为 15 分钟,因此正如预期的那样,对于某些输入,当输入落在多个窗口中时,我会得到多个输出。 计算出现
这个问题已经有答案了: Pandas Merging 101 (8 个回答) 已关闭 3 年前。 我有两个数据帧,我想对其执行外连接。两个数据框共享一个公共(public)索引名称以及多个也共享相同名
我在谷歌上搜索了很多天这个问题,但一无所获。我需要做一个 SELECT,DUPLICATE 和 DUPLICATE 和 DUPLICATE 取决于用户。之后,我需要将每个选项的值组合到我选择的一个选择
这个问题在这里已经有了答案: Java 8 Streams: multiple filters vs. complex condition (4 个答案) 关闭 4 年前。 需要过滤所有适合其领域某
运行 cv2.getRectSubPix(img, (5,5), (0,0)) 抛出错误: OpenCV Error: Unsupported format or combination of for
没有重复的组合看起来像这样,当可供选择的元素数 (n) 为 5 且选择的元素数 (r) 为 3 时: 0 1 2 0 1 3 0 1 4 0 2 3 0 2 4 0 3 4 1 2 3 1 2 4 1
我在学校的数学一直不太好,我意识到我实际上需要与 pow(base, exponent) 函数相反的函数,该函数对某个数字进行乘方运算,例如 2 ^ 4 = 16 搜索答案我发现对数 log() 应该
我确信这很简单,但我很难找到一种方法来做到这一点。基本上,如果我有一个包含 P 列和 V^P 行的数组,我如何填写所有组合,即基本上所有可能的数字以 P 数字的 V 为基数。例如,对于 P=3 和 V
我想知道一种可能的算法来计算所有可能的组合,没有重复,从 length=1 开始,直到 length=N 的 N 个元素。 例子: 元素:1、2、3。 输出: 1 2 3 12 13 23 123 最
使用三种不同颜色的颜料可以用多少种不同的方式来绘制立方体? 最佳答案 如果您以唯一可能的有趣方式解释它,那么这是一个比 3^6 更难的问题:有多少种不同的(即对称的)方法来为立方体着色。这是一篇论文:
我正在尝试解决优化问题,但首先我必须找到 n 个元素的所有可能组合的数量,但要考虑一些冲突。一个可能的例子是: 元素:{1,2,3,4}冲突:{1,2},{3,4} 术语“冲突”是指属于同一冲突集合的
Cleave 是一个非常有用的组合器,可以最大限度地减少代码重复。假设我要分类 Abundant, Perfect, Deficient numbers : USING: arrays assocs
有没有办法让 @Published 变量只在新值与旧值不同时才发布其值? 现在如果我们有 @Published var test: Bool = false 我们做到了 test = false te
有一个数组 [1, 2, ..., m] ,并且有一个整数 n . 如 m=2和 n=3 ,我想获得 [1, 1, 1] [1, 1, 2] [1, 2, 1] [1, 2, 2] [2, 1, 1]
我在我的应用程序中使用了一个用于日志记录页面的表单,并且在页脚上有一个绑定(bind)来显示任何错误,如下所示: 内容 View .Swift : Form { Section(footer: Tex
HTML first second third SCSS $statistics: ("first", "second", "third"); :root { --first: r
我有一个 HTTP 请求发布者,当返回 401 错误时,我想停止执行并显示我的登录屏幕。 这是我的代码的一部分: cancellable = fetcher.hello(helloRequest: H
我是一名优秀的程序员,十分优秀!