Firebase Dynamic Links not shortening URL

I’m trying to get Dynamic Links to shorten my URL with the following code:

guard let link = URL(string: "https://myapp.com") else { return } let dynamicLinksDomainURIPrefix = "https://app.myapp.com/link" let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix) linkBuilder?.iOSParameters = DynamicLinkIOSParameters(bundleID: "com.myapp.ios")  guard let longDynamicLink = linkBuilder?.url else { return } print("The long URL is: \(longDynamicLink)")  let options = DynamicLinkComponentsOptions() options.pathLength = .short linkBuilder?.options = options linkBuilder?.shorten() { url, warnings, error in   guard let url = url, error != nil else { return }   print("The short URL is: \(url)") } 

It’s printing the long URL fine, but the line below (for short URL) is never being called:

print("The short URL is: \(url)") 

Because url returns nil and I have no idea why. Nothing I’ve found in the guides or online has lead me in the right direction.

What am I missing?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.