swift share extension with 4文件类型

时间:2016-12-22 09:09:03

标签: ios objective-c swift

我想创建一个可以共享此类文件的shareExtenion:

vCard - 最多1个项目 图像 - 最多5项 视频 - 最多5项 文字 - 最多1项 url - 最多1件

我在NSExtensionAttribute:

中使用此代码
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
    $extensionItem.attachments,
    $attachment,
    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.vcard"
).@count == 1 || 
SUBQUERY (
    $extensionItem.attachments,
    $attachment,
    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
).@count < 6 || 
SUBQUERY (
    $extensionItem.attachments,
    $attachment,
    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.video"
).@count < 6 ||
SUBQUERY (
    $extensionItem.attachments,
    $attachment,
    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
).@count == 1 ||
SUBQUERY (
    $extensionItem.attachments,
    $attachment,
    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
).@count == 1
).@count == 1

问题是扩展在其他文件类型示例.doc或.pdf中可见,并且限制为&lt; 6不起作用!

有什么想法吗?

1 个答案:

答案 0 :(得分:-1)

   <key>NSExtensionActivationRule</key>
        <string>SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text").@count >= 1).@count >= 1
            OR SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, SUBQUERY($attachment.registeredTypeIdentifiers, $uti, $uti UTI-CONFORMS-TO "public.url" AND NOT $uti UTI-CONFORMS-TO "public.file-url").@count >= 1).@count >= 1).@count >= 1
            OR SUBQUERY(extensionItems,$extensionItem,SUBQUERY($extensionItem.attachments,$attachment,ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image").@count == $extensionItem.attachments.@count AND $extensionItem.attachments.@count &lt;= 5).@count == 1
            OR SUBQUERY(extensionItems,$extensionItem,SUBQUERY($extensionItem.attachments,$attachment,ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie").@count == $extensionItem.attachments.@count AND $extensionItem.attachments.@count &lt;= 5).@count == 1
            OR SUBQUERY(extensionItems,$extensionItem,SUBQUERY($extensionItem.attachments,$attachment,ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.content").@count == $extensionItem.attachments.@count AND $extensionItem.attachments.@count &lt;= 1).@count == 1
            </string>
    </dict>