简体   繁体   English

在Facebook中创建/编辑链接(应用托管API)

[英]Creating/Editing Links (App hosting API) in Facebook

I'm having trouble getting my head around app links for Facebook. 我无法理解Facebook的应用程序链接。 I am using the Facebook app link tool so I can host my link on Facebook. 我正在使用Facebook应用程序链接工具,因此可以将链接托管在Facebook上。 The first step where is says Register a Custom URL Scheme for iOS the screenshot is not clear at all 第一步说是注册 iOS的自定义URL方案 ,屏幕截图根本不清楚

"Custom URLs are defined in the info.plist file for your project. Under URL Types, add a new custom scheme of your choice in the URL Schemes array. For example, you can enter myBestApp as the URL Scheme. You can then enter myBestApp:// into your mobile browser to open your app." “自定义URL在项目的info.plist文件中定义。在URL Types下,在URL Schemes数组中添加您选择的新自定义方案。例如,您可以输入myBestApp作为URL Scheme。然后,您可以输入myBestApp ://进入您的移动浏览器以打开您的应用。”

If my choice of scheme is mySuperApp do I need to add mySuperApp or mySuperApp:// to the info.plist? 如果我选择的方案是mySuperApp ,是否需要将mySuperAppmySuperApp://添加到info.plist?

There is then a section that says: 然后有一个部分说:

URL with custom scheme 具有自定义方案的URL

A url with a custom scheme that will open your app. 具有自定义方案的网址将打开您的应用。 eg myapp://sample 例如myapp:// sample

What do I need to put here? 我需要在这里放什么? mySuperApp:// ? mySuperApp://吗? I don't understand why they have sample at the end. 我不明白为什么他们最后要抽样 Do I need to add it? 我需要添加吗? What does it mean? 这是什么意思?

Also I tried to create a link and I lost it. 我也尝试创建一个链接,但丢失了。 Is there anywhere you can view previously saved links and edit them? 在哪里可以查看以前保存的链接并进行编辑?

Any pointers would be really appreciated, having trouble getting this working and want to make sure I understand what I'm doing properly. 任何指针都将不胜感激,因为无法正常工作并且想要确保我了解自己的工作状况。 Not loving the Facebook docs. 不喜欢Facebook文档。

Have a look at the sample apps that ship with the SDK, they all register some form of custom schemes in order to use the SDK features. 看一下SDK附带的示例应用程序,它们都注册了某种形式的自定义方案,以便使用SDK功能。

In short, if your custom scheme is mySuperApp:// then you should add mySuperApp to your info.plist. 简而言之,如果您的自定义方案是mySuperApp:// ,则应将mySuperApp添加到info.plist。

There's no good way to view previously created links yet, we're working on that. 目前尚没有一种很好的方法来查看以前创建的链接,我们正在对此进行努力。 For now, just create a new app link host url. 现在,只需创建一个新的应用程序链接主机网址。

Think of your URI scheme as analogous to http for the browser. 认为您的URI方案类似于浏览器的http iOS and Android browsers have registered http as their URI scheme in their plist, so that any time a link is clicked for http://, the browser app will open up. iOS和Android浏览器已在其plist中将http注册为URI方案,因此,每次单击http://的链接时,浏览器应用程序都将打开。 You need to register for a similar type scheme, like myapp, so that any time someone clicks myapp://, your app will open. 您需要注册类似的类型方案,例如myapp,以便任何人单击myapp://时,您的应用程序都将打开。

Here's a quick tutorial on how to setup your plist file: 这是有关如何设置plist文件的快速教程:

  1. Click on YourProject-Info.plist on the left (or in Swift, Info.plist). 单击左侧的YourProject-Info.plist(或在Swift中,Info.plist)。
  2. Find URL Types and click the right arrow. 查找URL类型,然后单击向右箭头。 (If it doesn't exist, right click anywhere and choose Add Row. Scroll down and choose URL Types) (如果不存在,请右键单击任何地方,然后选择“添加行”。向下滚动并选择“ URL类型”)
  3. Add myapp , where myapp is a unique string for your app, as an item in URL Schemes as below: 添加myapp ,其中myapp是您的应用程序的唯一字符串,作为URL方案中的一项,如下所示:

uri示例

Just a heads up, the service I helped build, branch.io , makes hosting your Facebook AppLinks really easy. 请注意,我帮助构建的服务branch.io使得托管Facebook AppLink变得非常容易。 We've got a fully functional dashboard to manage all of the previously created links as well. 我们有一个功能齐全的仪表板来管理所有以前创建的链接。

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

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