简体   繁体   English

如果已安装在iPhone中,则在Facebook中打开一个共享链接以在本机应用程序中打开

[英]Open a shared link in facebook to open in native app if installled in iphone

I am struggling with one thing. 我为一件事而苦苦挣扎。 Below is the scenario: 下面是方案:

I have a website which has a feature to share a link with facebook. 我有一个网站,可以与Facebook分享链接。 What I want is if someone has the facebook app installed in the iPhone and clicks on the link, it should open it in the app to which that link belongs, if that app is installed. 我想要的是,如果某人在iPhone中安装了facebook应用程序,然后单击链接,则应该在该链接所属的应用程序中打开它(如果已安装该应用程序)。

Could you help me? 你可以帮帮我吗? How can I achieve this ? 我该如何实现?

You need the URL scheme, which can be found here 您需要URL方案,可以在这里找到

Facebook iOS URL Scheme Facebook iOS URL方案

You will need to open the URL like so 您将需要像这样打开URL

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.some URL.com"]];

You can check and open some specifics applications using url which they are shared their url scheme here . 您可以使用url检查并打开一些特定的应用程序,这些应用程序在此处共享了url方案。

For example with facebook, you can check if the user has the app installed : 例如,使用facebook,您可以检查用户是否已安装该应用程序:

[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://profile"]];

And call this method to open the application : 并调用此方法打开应用程序:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile"]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM