具有NSExtensionActivationRule自定义子查询的iOS共享扩展
我已经为iOS应用程序实现了共享扩展。 该扩展可以成功地处理图像和视频 现在,我正在寻找一种方法,使扩展能够适用于更多的文件类型,例如PDF、电子表格(Excel、页面等)、文档(MS Word、其他类似类型)、演示文稿(Powerpoint、页面等)、简单文本文件(Txt、xml、.c、.h、任何其他文件)和网页URL 问题是我希望能够使用以下规则激活扩展: 1。图像和视频可以一起选择,总共25个 项目,最多25个图像和/或最多5个视频。所以我们可以 只有1-25张图片或1-5张视频或20张图片和5张视频或任意组合,只要项目总数小于或等于25张,视频小于或等于5张 2。如果选择图像或视频,则不能选择其他类型 已选择。 3。PDF最大值为1,未选择其他类型。 4。电子表格最多5张,未选择其他类型。 我一直试图通过使用NSExtensionActivationRule的自定义子查询来实现这一点,但一直没有弄明白 我读过很多关于堆栈溢出的文章,也读过一些关于堆栈溢出的文章,还有苹果文档,这些文档除了简单的例子外没有其他内容,但是我还没有成功地编写出符合我要求的子查询 例如,我尝试编写以下子查询,该子查询应仅在选择图像时激活扩展,并特别忽略PDF、演示文稿、音频、电影和文本文件。但是文本和PDF的扩展被激活,其他被忽略的项目也可能被激活,尽管我没有具体检查每个项目具有NSExtensionActivationRule自定义子查询的iOS共享扩展,ios,ios8-share-extension,Ios,Ios8 Share Extension,我已经为iOS应用程序实现了共享扩展。 该扩展可以成功地处理图像和视频 现在,我正在寻找一种方法,使扩展能够适用于更多的文件类型,例如PDF、电子表格(Excel、页面等)、文档(MS Word、其他类似类型)、演示文稿(Powerpoint、页面等)、简单文本文件(Txt、xml、.c、.h、任何其他文件)和网页URL 问题是我希望能够使用以下规则激活扩展: 1。图像和视频可以一起选择,总共25个 项目,最多25个图像和/或最多5个视频。所以我们可以 只有1-25张图片或1-5张视频或20张图
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
(
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.fax"
|| 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 "public.camera-raw-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.pict"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.macpaint-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.xbitmap-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.quicktime-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.icns"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.photoshop-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.illustrator.ai-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.microsoft.bmp"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.microsoft.ico"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.truevision.tga-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.sgi.sgi-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.ilm.openexr-image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.kodak.flashpix.image"
)
AND
(
NOT ( ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.composite-content"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.presentation"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.audio”
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie”
)
)
).@count == $extensionItem.attachments.@count
).@count <=50
子查询(
伸展岩,
多边主义,
子查询(
$m.attachments,
$附件,
(
任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.image”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.fax”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.jpeg”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.jpeg-2000”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.tiff”
||任何$attachment.registeredTypeIdentifiers UTI-符合“public.camera原始图像”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.apple.pict”
||任何$attachment.registeredTypeIdentifiers UTI-符合“com.apple.macpaint image”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.png”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.xbitmap image”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.apple.quicktime图像”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.apple.icns”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.adobe.photoshop-“图像”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.adobe.illustrator.ai-“图像”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.microsoft.bmp”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.microsoft.ico”
||任何$attachment.registeredTypeIdentifiers UTI-符合“com.truevision.tga image”
||任何$attachment.registeredTypeIdentifiers UTI-compliance-TO“com.sgi.sgi image”
||任何$attachment.registeredTypeIdentifiers UTI-compliance-TO“com.ilm.openexr image”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“com.kodak.flashpix.image”
)
及
(
不(任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.composite content”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.text”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.presentation”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.audio”
||任何$attachment.registeredTypeIdentifiers UTI-Compliance-TO“public.movie”
)
)
)@count=$extensionItem.attachments@count
).@count我不熟悉NSExtensionActivationRule
,所以这可能是个误会,但我想知道子查询的最后一行是否有问题:如果附件不符合内部子查询条件,extensionItems的计数将为零-这是我对此的有限理解,子查询
不应允许在任何非图像项的情况下激活扩展,因为它明确包含需要忽略的类型,我认为最终计数在这种情况下并不重要。最终计数应仅受图像项目的影响。