iOS装置分享扩展不工作的图片网址
问题描述:
我有一个使用这些规则每股扩展:iOS装置分享扩展不工作的图片网址
<dict>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsText</key>
<integer>1</integer>
</dict>
它完全正常的网站和图像,但我无法解析图片网址是这样的:(http://www.zappos.com/images/z/3/3/5/4/0/3/3354034-p-2x.jpg) 。我厌倦了添加其他规则,但是当我使用Safari打开此网站并点击共享时,我的共享扩展名仍不会显示。
但是,如果我使规则TRUEPREDICATE,我的共享扩展可以解析网站。
我做错了什么? 谢谢
答
大厦关闭wj2061的回答,下面的断言会抢主机应用程序提供的任何和所有附件。
<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.item" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.content"
)[email protected] == [email protected]
)[email protected] > 0
</string>
+0
这不适合我。 –
答
你没有做错任何事,只是因为Apple定义的常用密钥(下图)不能包含所有的情况。
对于你的情况,你必须写自己的NSPredicate String作为苹果这里建议:Declaring Supported Data Types for a Share or Action Extension
我改变了苹果的例子是这样的:
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image";
)[email protected] == [email protected]
)[email protected] == 1
</string>
</dict>
您可以更改public.image
到任何其他Uniform Type Identifiers。
答
我通过
<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
(
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
)
)[email protected] == [email protected]
)[email protected] > 0</string>
解决此问题的最后一行@count> 0奏效了我。
我能够通过只使用public.url从safari获取.jpg并删除public.image的所有子项。 –