0

I am working on an app in which I want to let the user share content on their facebook feed with app's link (just the way Soundcloud does it)

To achieve this, I have tried different things. I was able to share a simple picture and a link (separately) successfully, but when it came to sharing link of the app, I got stuck.

I have gone through most of the posts related to this. I have tried

Facebook deep linking with iOS app

and

How to implement iOS app link Facebook functionality in swift 3?

but couldn't find anything appropriate. This doc:

https://developers.facebook.com/docs/applinks/ios

could have been of help but it only shows how to handle incoming app links. My question is

1. How do I share app link through my iOS App?

Moreover it is mentioned:

The link your app will receive will look like this: [url]?al_applink_data=JSON_ENCODED_DATA Where url is the incoming URL based on a custom scheme that you've defined for your app. You'll also receive an al_applink_data query parameter with JSON_ENCODED_DATA content that looks something like this:

 {
     "target_url": "https://www.example.com/abc.html",
     "extras": {
         "fb_app_id": [YOUR_FACEBOOK_APP_ID],
         "fb_access_token": "[ACCESS_TOKEN']",
         "fb_expires_in": "3600"
     },
     "referer_app_link": {
         "url": "[FACEBOOK_APP_BACK_LINK]",
         "app_name": "Facebook"
     } }

Where fb_access_token and fb_expires_in are only available if the person has authenticated with Facebook in your app.

2. How do I create the link?

If this is the way to do it (from https://developers.facebook.com/docs/applinks/add-to-content and Deep Linking Facebook iOS - App don't open)

As an example, let's say you've got a page located at:

http://example.com/applinks

In that page you need to add some metadata to describe what app will handle it:

<html>
<head>
    <meta property="al:ios:url" content="example://applinks" />
    <meta property="al:ios:app_store_id" content="12345" />
    <meta property="al:ios:app_name" content="Example App" />
    <meta property="og:title" content="example page title" />
    <meta property="og:type" content="website" />
    <!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
</head> 

3. Then where do I write this html?

4. From where do I get such http://example.com/applinks link?

Right now I just have my app's custom schema which I have created in my info.plist file.

kinza
  • 535
  • 11
  • 31
  • Answer to your question 3. can be found in what you quoted under 2. – 04FS Jan 28 '19 at 12:23
  • 04FS? Where is the page in which i need to add meta data? I only have an iOS app. – kinza Jan 29 '19 at 04:26
  • The page you want to share, of course. App Links are a mechanism for you to have _your_ content open your app, if available. – 04FS Jan 29 '19 at 07:15

0 Answers0