IOS Safari URL UTI 共享表 [英] IOS Safari URL UTI share sheet
问题描述
我正在尝试使用 safari 共享按钮和共享表将当前 URL 从 safari 传递到我的应用程序.我希望它进入我的应用程序,而不是让它成为共享扩展.在 safari 中,共享表没有显示我的应用程序.我注册了以下文件类型 (UTI) 没有成功:
I am trying to pass the current URL from safari to my app using the safari share button and share sheet. I want this to go to my app and not have it be a share extension. From safari, the share sheet does not show my app. I have registered the following document types (UTI) without success:
public.url
public.file-url
public.url-name
我的应用程序确实从使用 com.adobe.pdf 的 pdf 文档共享中显示出来,没有任何问题.任何从 safari 共享 URL 的帮助将不胜感激.我在使用 Apple 应用显示的照片中的共享按钮时也遇到了类似的问题.
My app does show up from a pdf document share using com.adobe.pdf without any issues. Any help sharing the URL from safari would be most appreciated. I am also having a similar issue with using share button from a photo displayed from the apple app.
Safari url 的正确 UTI 和通过共享按钮正确显示在共享表上的照片是什么?谢谢.
What are the correct UTI for safari url and a photo via the share button to properly appear on the share sheet? Thanks.
鲍勃
推荐答案
- 转到项目(项目导航器中的根元素)并选择您的共享目标
- 转到信息
- 打开
NSEXtension
->NSExtensionAttributes
->NSExtensionActivationRule
- 对于 URL 支持:在
NSExtensionActivationRule
下方添加NSExtensionActivationSupportsWebURLWithMaxCount
(类型为Number
,该值是大于 0 的任何数字,具体取决于您的 URL 数量允许在一次共享操作中处理) - 对于照片和/或视频支持,添加
NSExtensionActivationSupportsImageWithMaxCount
和/或NSExtensionActivationSupportsMovieWithMaxCount
- 对于其他文件类型添加
NSExtensionActivationSupportsFileWithMaxCount
- Go to the project (root element in the Project Navigator) and select your Share target
- Go to Info
- Open
NSEXtension
->NSExtensionAttributes
->NSExtensionActivationRule
- For URL Support: Add
NSExtensionActivationSupportsWebURLWithMaxCount
underneathNSExtensionActivationRule
(type isNumber
, the value is any number higher than 0 depending how many URL's you allow to handle in one share action) - For Photo and/or Video Support add
NSExtensionActivationSupportsImageWithMaxCount
and/orNSExtensionActivationSupportsMovieWithMaxCount
- For other file types add
NSExtensionActivationSupportsFileWithMaxCount
在您的共享目标的 Info.plist 文件的原始代码中,它将如下所示:
In the raw code of the Info.plist file of your Share target it will look like this:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>YourStoryboard</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>
注意那些没有在 Dropbox 的导出表中看到他们的应用程序的人:Dropbox 将 URL 传递给共享表,您必须支持 NSExtensionActivationSupportsWebURLWithMaxCount
NOTE for people who don't see their app appearing in Dropbox'es Export sheet: Dropbox passes a URL to the share sheet, you'd have to support NSExtensionActivationSupportsWebURLWithMaxCount
这篇关于IOS Safari URL UTI 共享表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!