Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html iOS Safari上Pinterest打开线路板URL的自定义URL方案?_Html_Ios_Pinterest_Url Scheme - Fatal编程技术网

Html iOS Safari上Pinterest打开线路板URL的自定义URL方案?

Html iOS Safari上Pinterest打开线路板URL的自定义URL方案?,html,ios,pinterest,url-scheme,Html,Ios,Pinterest,Url Scheme,我一辈子都不知道如何通过HTML中的锚来简单地打开Pinterest板(如果安装了应用程序,则启动该应用程序) 我看了一下,但还是找不到我要找的东西。似乎大多数文档都更倾向于固定项目,而不是查看 我只想打开一个用户档案。例如,我发现以下内容非常适用于其他社交媒体链接: <a href="fb://profile/23050834961">Facebook</a> <a href="twitter://user?screen_name=NHLBruins">T

我一辈子都不知道如何通过HTML中的锚来简单地打开Pinterest板(如果安装了应用程序,则启动该应用程序)

我看了一下,但还是找不到我要找的东西。似乎大多数文档都更倾向于固定项目,而不是查看

我只想打开一个用户档案。例如,我发现以下内容非常适用于其他社交媒体链接:

<a href="fb://profile/23050834961">Facebook</a>

<a href="twitter://user?screen_name=NHLBruins">Twitter</a>

<a href="instagram://user?username=nhlbruins">Instagram</a>

虽然我能够启动Pinterest应用程序,但我不确定在Pinterest上打开特定配置文件/电路板时会传递哪些参数:

<a href="pinterest://">Pinterest</a>


感谢:提供上述帮助,但Pinterest似乎缺席。有什么线索吗?

看起来Pinterest发布了一个iOS SDK,并定义了一些URL:

大头针
pinterest://pin/285063851385287883/
板
pinterest://board/meaghanror/cats-cats-cats/
使用者
pinterest://user/carlrice/


更多信息请参见

Pinterest发布了iOS SDK,并定义了一些URL:

大头针
pinterest://pin/285063851385287883/
板
pinterest://board/meaghanror/cats-cats-cats/
使用者
pinterest://user/carlrice/


有关Swift 4.x的更多信息,请参见工作代码

func openSocialMedia(appURI : String, webURI : String){
    let appURL = NSURL(string: appURI)!
    let webURL = NSURL(string: webURI)!
    if UIApplication.shared.canOpenURL(appURL as URL) {
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(appURL as URL, options: [:], completionHandler: nil)
        } else {
            UIApplication.shared.openURL(appURL as URL)
        }
    } else {
        //redirect to safari because the user doesn't have Instagram
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(webURL as URL, options: [:], completionHandler: nil)
        } else {
            UIApplication.shared.openURL(webURL as URL)
        }
    }
}
如何呼叫

@IBAction func didPressInstagram(_ sender: Any) {
    let appHandle = "instagram://user?username=erashukr"
    let webHandle = "https://instagram.com/erashukr"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)
}


@IBAction func didPressGplus(_ sender: UIButton) {
    let appHandle = "gplus://plus.google.com/u/0/+Ashutoshkumarrr"
    let webHandle = "https://plus.google.com/u/0/+Ashutoshkumarrr"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)

}

  @IBAction func didPressFacebook(_ sender: Any) {
    let appHandle = "fb://profile?id=erashukr"
    let webHandle = "https://facebook.com/erashukr"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)

}

@IBAction func didPressTwitter(_ sender: UIButton) {
    let appHandle = "twitter://user?screen_name=ace_ashu"
    let webHandle = "https://twitter.com/ace_ashu"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)
}

@IBAction func didPressPinterest(_ sender: UIButton) {
    let appHandle = "pinterest://user/apple"
    let webHandle = "https://www.pinterest.com/apple/"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)
}

100%工作Swift 4.x的工作代码

func openSocialMedia(appURI : String, webURI : String){
    let appURL = NSURL(string: appURI)!
    let webURL = NSURL(string: webURI)!
    if UIApplication.shared.canOpenURL(appURL as URL) {
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(appURL as URL, options: [:], completionHandler: nil)
        } else {
            UIApplication.shared.openURL(appURL as URL)
        }
    } else {
        //redirect to safari because the user doesn't have Instagram
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(webURL as URL, options: [:], completionHandler: nil)
        } else {
            UIApplication.shared.openURL(webURL as URL)
        }
    }
}
如何呼叫

@IBAction func didPressInstagram(_ sender: Any) {
    let appHandle = "instagram://user?username=erashukr"
    let webHandle = "https://instagram.com/erashukr"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)
}


@IBAction func didPressGplus(_ sender: UIButton) {
    let appHandle = "gplus://plus.google.com/u/0/+Ashutoshkumarrr"
    let webHandle = "https://plus.google.com/u/0/+Ashutoshkumarrr"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)

}

  @IBAction func didPressFacebook(_ sender: Any) {
    let appHandle = "fb://profile?id=erashukr"
    let webHandle = "https://facebook.com/erashukr"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)

}

@IBAction func didPressTwitter(_ sender: UIButton) {
    let appHandle = "twitter://user?screen_name=ace_ashu"
    let webHandle = "https://twitter.com/ace_ashu"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)
}

@IBAction func didPressPinterest(_ sender: UIButton) {
    let appHandle = "pinterest://user/apple"
    let webHandle = "https://www.pinterest.com/apple/"
    self.openSocialMedia(appURI: appHandle, webURI: webHandle)
}

100%工作

我不知道我怎么会错过这个。谢谢@dpassageNo问题!我自己也错过了更多引人注目的事情:)我们可以用这种方法创建pinterest pin吗?我不知道我怎么会错过这个。谢谢@dpassageNo问题!我自己也错过了更引人注目的事情:)我们可以用这种方法创建pinterest pin吗?我如何每次为所有FB、Twitter、pinterest、Instagram、Linkedin、Spotify、Snapchat、VSCO打开新闻提要(主页)页面?我如何每次为所有FB、Twitter、pinterest、Instagram、Linkedin、Spotify、Snapchat打开新闻提要(主页)页面,VSCO?