简体   繁体   中英

Creating/Editing Links (App hosting API) in Facebook

I'm having trouble getting my head around app links for Facebook. I am using the Facebook app link tool so I can host my link on Facebook. The first step where is says Register a Custom URL Scheme for iOS the screenshot is not clear at all

"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."

If my choice of scheme is mySuperApp do I need to add mySuperApp or mySuperApp:// to the info.plist?

There is then a section that says:

URL with custom scheme

A url with a custom scheme that will open your app. eg myapp://sample

What do I need to put here? 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.

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.

In short, if your custom scheme is mySuperApp:// then you should add mySuperApp to your 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. 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. You need to register for a similar type scheme, like myapp, so that any time someone clicks myapp://, your app will open.

Here's a quick tutorial on how to setup your plist file:

  1. Click on YourProject-Info.plist on the left (or in Swift, Info.plist).
  2. Find URL Types and click the right arrow. (If it doesn't exist, right click anywhere and choose Add Row. Scroll down and choose URL Types)
  3. Add myapp , where myapp is a unique string for your app, as an item in URL Schemes as below:

uri示例

Just a heads up, the service I helped build, branch.io , makes hosting your Facebook AppLinks really easy. We've got a fully functional dashboard to manage all of the previously created links as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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