适用于iOS应用的通用链接

时间:2018-02-21 13:13:15

标签: ios ios-universal-links

有没有办法从通用链接(例如相机应用程序)打开默认iOS应用程序。

如果是这样,我在哪里可以找到这些公共通用链接?

1 个答案:

答案 0 :(得分:3)

你的意思是这个功能吗?

func open(_ scheme: String) {
    guard let url = URL(string: scheme) else {
        return
    }
    if UIApplication.shared.canOpenURL(url) {
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(url)
        } else {
            UIApplication.shared.open(url as URL, options: [:], completionHandler: nil)
        }
    }
}

// usage:
open("App-Prefs:root")

Apple documentation about URL Schemes

Gist for iOS Settings

相关问题