我试图在iOS中使用SLComposeServiceViewController共享文档,我正在测试它的文档是一个pdf(虽然我需要能够共享任何文件)。 我将我的PDF发送到iPhone上的邮件,按住附件,但我的图标从未显示。 我的图片,网址和文字共享工作正常,我似乎无法使任何类型的文档生效。
我假设需要设置NSExtensionActivationSupportsAttachmentsWithMaxCount和/或NSExtensionActivationSupportsFileWithMaxCount,但我不知道它们之间有什么区别。
这是我现在的plist ......
有人可以帮忙吗?
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsAttachmentsWithMinCount</key>
<integer>0</integer>
<key>NSExtensionActivationSupportsAttachmentsWithMaxCount</key>
<integer>20</integer>
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
<integer>0</integer>
<key>NSExtensionActivationSupportsText</key>
<true/>
<key>NSExtensionActivationSupportsVideoWithMaxCount</key>
<integer>0</integer>
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
<integer>0</integer>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>
&#13;
答案 0 :(得分:2)
这些是谓词,所有这些都必须满足您的扩展才能显示。您可能只需要 NSExtensionActivationSupportsAttachmentsWithMinCount :
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsAttachmentsWithMinCount</key>
<integer>1</integer>
</dict>
<key>NSExtensionPointName</key>
<string>com.apple.share-services</string>
<key>NSExtensionPointVersion</key>
<string>1.0</string>
</dict>
仅使用TRUEPREDICATE进行测试,以确保谓词确实是导致问题的原因。
还有一件事:默认情况下不启用共享扩展,因此请务必检查共享目标列表末尾的更多[...]按钮。
答案 1 :(得分:0)
您可以在扩展名info.plist中使用此代码从Mail(或类似)和Dropbox(Box,iCloud或类似)获取文件
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>