我开发了一个共享扩展,并从照片和便笺应用程序导入照片和便笺。 我想限制可以导入的照片数量只有10但是对于照片我能够选择无限的照片。以下是来自info.plist扩展名的查询。 任何人都可以调查并引导我纠正错误。
<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>
答案 0 :(得分:2)
得到了答案。改变是为了线
@count == $ extensionItem.attachments。@ count)。@ count == 1
到
@count&lt; = 10)。@ count&gt; = 1
其中说你的计数应该是&lt; = 10且&gt; = 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>
答案 1 :(得分:2)
IN ShareExtension Info add
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>