I have a simple function how to receive a short dynamic link:
func shorten() {
let builder = DynamicLinkComponents(link: link, domainURIPrefix: "myprefix")
builder?.shorten { url, _, error in
print(url) // ✅ https://joyabc.page.link/zagQctdk4CJ4nSWF6
}
}
But now I try to receive my source long link base on shorten link. Is it possible?
let builder = DynamicLinkComponents(link: link, domainURIPrefix: "myprefix")
guard let link = builder?.url else {
return
}
print(link) // ❌ https://joyabc.page.link/?link=https%3A%2F%2Fjoyabc%2Epage%2Elink%2FzagQctdk4CJ4nSWF6
But it is not the source link I have create a short link from. What am I doing wrong?
Simple answer is:
let url: URL //your short url
DynamicLinks.dynamicLinks().resolveShortLink(link) { url, error in
// url
}