在iOS Safari中单击“共享”按钮时(通过工具栏或长按链接),我希望我的应用程序显示为“在...中打开”选项(例如,“在新闻中打开” ”),以便我的应用(这是另一种网络浏览器)可以打开Safari共享的任何内容http://或https://URL。
我已经在苹果info.plist文件中注册了文档类型“ URL”(我相信这是正确的类型,如果此假设是错误的,请更正!),我CFBundleDocumentTypes可以从Apple的“注册应用程序支持的文件类型”文档中猜到,他们的技术问答以及与之相关的StackOverflow帖子1 2 3:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>appIcon320</string>
<string>appIcon64</string>
</array>
<key>CFBundleTypeName</key>
<string>URL</string>
<key>CFBundleTypeRole</key>
<string>Editor</string> <!-- Note: I have also tried 'Viewer' -->
<key>LSHandlerRank</key>
<string>Owner</string> <!-- Note: I have also tried 'Default' -->
<key>LSItemContentTypes</key>
<array>
<string>public.url</string>
</array>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
我也用以下代码编写了这个存根方法AppDelegate.swift(尽管我认为实际上与使我的应用程序显示为“打开方式...”选项的第一阶段的成功无关):
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {opening-in-app-getting-uiapplicationlaunchoptionsurlkey-from-launchoptions?rq=1
print("Received URL: \(url); from …Run Code Online (Sandbox Code Playgroud) 我是 Android 开发人员,但我需要回答一些有关其他平台的可能性的问题,我想知道 iOS 提供了哪些与http://developer.android.com/reference/android/accounts/AccountManager.html相当的功能。我找到了https://developer.apple.com/library/ios/documentation/Accounts/Reference/ACAccountClassRef/Reference/Reference.html,但我无法理解全部可能性。
问题:
很高兴收到简短而快速的回复!// 乔纳斯