我在iOS9的两种不同方案的共享扩展中有一个问题(与iOS8 配合良好)---(希望共享PDF ):
首先转到带有PDF附件邮件的邮件应用程序-
registeredTypeIdentifiers: (
"public.file-url",
"com.adobe.pdf"
)
registeredTypeIdentifiers: (
"com.adobe.pdf"
)
我应该怎么做才能在第二种情况下获得“public.file-url” 。
See the screen short of 2nd scenario
我在plist中使用以下提及SUBQUERY的方法:
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
(
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg-2000"
)
).@count == $extensionItem.attachments.@count
).@count == 1
最佳答案
为共享扩展名定制文档类型
在键NSExtensionActivationRule下写谓词
例如:对于pdf和图像,我做出以下谓词,最大文档数为1。
<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 "com.adobe.pdf"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg-2000"
)
).@count == $extensionItem.attachments.@count
).@count == 1</string>
关于ios - iOS 9-强制共享扩展以获取public.file-url,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33383478/