'Creating branch links from iOS that shows the same values as dashboard link
Product team already created a quick link on dashboard, and it already has a Title, Description, and ImageURL. It's something like this https://myapp.app.link/ticket
I am showing tickets on my iOS application. Whenever user selects share option on a ticket, I am using below code to populate iOS share sheet
let buo = BranchUniversalObject(canonicalIdentifier: "ticket/id?=" + ticketId)
buo.contentMetadata.customMetadata["id"] = ticketId
buo.publiclyIndex = true
buo.locallyIndex = true
let lp: BranchLinkProperties = BranchLinkProperties()
lp.addControlParam("channel", withValue: "app")
lp.addControlParam("feature", withValue: "ticket_share")
lp.addControlParam("$deeplink_path", withValue: "ticket/?id=" + ticketId)
buo.showShareSheet(with: lp, andShareText: message, from: viewController, completion: nil)
When I share this link, it appears something like https://myapp.app.link/RANDOMNUMBERS and I don't see the Title, Description, or ImageURL that are set at branch dashboard.
How can I create a URL using BranchUniversalObject and BranchLinkProperties that fits the one on dashboard (so something like this https://myapp.app.link/ticket?id=123123) and shows the correct Title, Description, and ImageURL?
Edit: When I try to add lp.alias = "ticket" I am getting below error from branch sdk
Error Domain=io.branch.sdk.error Code=1001 "A resource with this identifier already exists."
I don't want to push a new version of the app everytime we want to change shared description or image, that's why I want to use existing created link on branch dashboard
Solution 1:[1]
You don't have to update your app each time social media tags such as title or image are updated. You can do this per link basis (https://dashboard.branch.io/quick-links/qlc/config/ under Social Media tab) or globally on link settings: https://dashboard.branch.io/link-settings/general. Alternatively, you can add the following OG tags in the link data when creating links via the SDK or API: $og_title, $og_description, $og_image_url. More info on this: https://docs.branch.io/activity-reports-analytics/content-analytics/#how-does-branch-identify-my-content
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jackie Choi |
