【发布时间】:2021-01-08 13:04:01
【问题描述】:
使用Swift5.3.2,iOS13.0,
我的共享扩展程序适用于图像和视频。
但它不适用于 PDF。
问题是我的应用在我尝试与我的应用共享的 PDF 文档的共享应用列表中不可见。
我知道必须在 info.plist 中正确设置规则。
我尝试了以下两次尝试 - 但都没有成功!
谁能告诉我 iOS 中的 PDF 共享扩展需要什么?
尝试 1:Info.plist
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>20</integer>
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>100</integer>
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
<integer>25</integer>
</dict>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
<key>NSExtensionPrincipalClass</key>
<string>CustomShareNavigationController</string>
</dict>
尝试 2: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 "com.adobe.pdf"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg"
|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
).@count == $extensionItem.attachments.@count
).@count == 1
</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
<key>NSExtensionPrincipalClass</key>
<string>CustomShareNavigationController</string>
</dict>
【问题讨论】:
-
您好,您找到解决方案了吗?我也被困在这里 :( 而且 Apple 文档没有帮助。developer.apple.com/library/archive/documentation/General/…
标签: swift share ios8-share-extension uiactivityitemprovider