我有一个使用这些规则的共享扩展:
<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 http://www.zappos.com/images/z/3/3/5/4/0/3/3354034-p-2x.jpg)。我厌倦了添加其他规则,但当我使用 Safari 打开此网站并单击共享时,我的共享扩展程序仍然不会出现。
但如果我将规则设置为 TRUEPREDICATE,我的共享扩展就可以解析该网站。
我做错了什么?
谢谢
你没有做错什么,只是因为Apple定义的公共键(如下图)不能包含所有情况。
对于您的情况,您必须按照 Apple 的建议编写自己的 NSPredicate String :声明共享或操作扩展支持的数据类型 https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW8
我像这样改变了苹果的例子:
<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
</string>
</dict>
你可以改变public.image
给任何其他人统一类型标识符 https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html.
Some of the common UTIs are listed below:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)