你如何找到你想要在应用程序中打开的应用程序的网址?

时间:2017-08-07 21:06:18

标签: ios swift

我试图打开一个已安装在手机上的应用程序,但需要一个网址才能打开它。这是我使用的功能:

func openAppFromMenu(inAppURL: URL?, appStoreURL: URL?) {

    if inAppURL != nil {

        if UIApplication.shared.canOpenURL(inAppURL!)
        {
            UIApplication.shared.openURL(inAppURL!)
        } else {
            //redirect to safari because the user doesn't have in app
            print("App not installed")

            if UIApplication.shared.canOpenURL(appStoreURL! as URL) {
                UIApplication.shared.openURL(appStoreURL!)
            }
        }
    } else {
        //redirect to safari because the user doesn't in app
        print("App not installed")
        if UIApplication.shared.canOpenURL(appStoreURL! as URL) {
            UIApplication.shared.openURL(appStoreURL!)
        }
    }
}

如何找到该应用的应用内和应用商店网址?

0 个答案:

没有答案