问题描述
我已经开发了共享扩展程序,并从照片和笔记"应用程序导入了照片和笔记.我想将只能导入的照片数量限制为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 >= 1).@count >= 1).@count >= 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 >= 1Which 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 <= 10).@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 >= 1).@count >= 1).@count >= 1
</string>
</dict>
这篇关于NSExtension分享扩展限制照片数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!