NSExtension分享扩展限制照片数量 [英] NSExtension Share Extension limit Photos count

查看:129
本文介绍了NSExtension分享扩展限制照片数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了共享扩展程序,并从照片和笔记"应用程序导入了照片和笔记. 我想将只能导入的照片数量限制为10张,但是对于照片",我可以选择不限数量的照片.以下是来自扩展名info.plist的查询. 任何人都可以调查并指导我更正查询.

I have developed a Share Extension and import Photos and Notes from Photos and Notes App. I want to limit the count of Photos which can be import to only 10 but for Photos i am able to select unlimited photos. Below is the query from info.plist of extension. Can anyone look into it and guide me to correct query.

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

推荐答案

得到答案.更改是针对行 @count == $ extensionItem.attachments.@ count).@ count == 1 到
@count< = 10).@ count> = 1 上面说您的计数应为< = 10和> = 1

Got the answer. The change is for line @count == $extensionItem.attachments.@count).@count == 1 to
@count <= 10).@count >= 1 Which says your count should be <=10 and >=1

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

这篇关于NSExtension分享扩展限制照片数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆