Skip to main content

Migrate Firebase Dynamic Links on iOS

The native Ulinkly iOS SDK (ios_ulink_sdk) replaces Firebase Dynamic Links with first-party support for universal links, custom schemes, installation tracking, and link creation. Follow these steps to swap SDKs while keeping your routing logic intact.


1. Install the SDK​

Choose CocoaPods or Swift Package Manager (see the iOS Getting Started guide):

pod 'ULinkSDK', '~> 1.2.4'

or

.package(url: "https://github.com/mohn93/ios_ulink_sdk.git", from: "1.2.4")

2. Confirm dashboard configuration​

The overview prerequisites already cover this, but double-check the key items before swapping SDK code:

  • Settings → Configure → iOS: bundle ID, deep linking schema (e.g. myapp://), Team ID. The App Store fallback is set on each link.
  • Domains: shared .shared.ly or custom domain verified (Ulinkly hosts the apple-app-site-association file automatically).
  • Links: every Firebase slug recreated with its new type and metadata (use the dashboard or /sdk/links API).

This lets the rest of the page stay focused on iOS-specific implementation details.


3. Initialize Ulinkly instead of Firebase​

Replace any DynamicLinks.dynamicLinks() initialization with the Ulinkly SDK inside AppDelegate:

import ULinkSDK
import Combine

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var cancellables = Set<AnyCancellable>()

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {

let config = ULinkConfig(
apiKey: "ULINK_API_KEY_FROM_DASHBOARD",
debug: true
)

Task {
do {
// initialize is async
_ = try await ULink.initialize(config: config)
} catch {
// The SDK instance still exists after a failed bootstrap and retries later
print("ULink initialization error: \(error)")
}
// Subscribe once initialize has returned, whether or not it threw
guard ULink.isInitialized else { return }
let ulink = ULink.shared

ulink.dynamicLinkStream.sink { [weak self] resolved in
self?.handleDynamicLink(resolved)
}.store(in: &self.cancellables)

ulink.unifiedLinkStream.sink { [weak self] resolved in
self?.handleUnifiedLink(resolved)
}.store(in: &self.cancellables)
}

return true
}
}
  • dynamicLinkStream replaces Firebase’s dynamic-link callback with strongly typed ULinkResolvedData.
  • unifiedLinkStream delivers unified links (platform redirects) that opened your app.
  • Don't read ULink.shared until initialization has finished; it stops the app if read too early.

Firebase required custom logic in application(_:open:options:). The Ulinkly SDK uses the same entry points:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return ULink.handleIncomingURL(url)
}

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else {
return false
}
return ULink.handleIncomingURL(url)
}

Use the static ULink.handleIncomingURL(_:): on a cold launch these handlers can run before initialization finishes, and it holds the URL until the SDK is ready.

Because the dashboard hosts the apple-app-site-association file, you only need to add applinks:YOURDOMAIN.shared.ly (or your custom host) in the Associated Domains capability.


5. Replace Firebase REST helpers​

If your app generated Firebase links locally, build them with the ULinkParameters factories and call createLink (after initialization has finished).

let parameters = ULinkParameters.dynamic(
domain: "links.shared.ly",
slug: "ioslaunch2024",
iosFallbackUrl: "https://apps.apple.com/app/id123456789",
androidFallbackUrl: "https://play.google.com/store/apps/details?id=com.example.app",
fallbackUrl: "https://example.com/launch",
parameters: ["utm_source": "ios-app"],
socialMediaTags: SocialMediaTags(
ogTitle: "Launch Offer",
ogDescription: "Redeem inside the app",
ogImage: "https://example.com/og.png"
)
)

Task {
let response = try await ULink.shared.createLink(parameters: parameters)
print("Created link: \(response.url ?? "no url")")
}

Unified links use ULinkParameters.unified with per-platform URLs (iosUrl, androidUrl, fallbackUrl), for platform redirects such as marketing pages.


6. Test before shipping​

  1. Use Safari to open the new https://links.shared.ly/<slug> URLs and confirm the app delegate receives events.
  2. Hit https://api.ulink.ly/v1/sdk/resolve?url=... when debugging to see the resolved payload the redirect service uses. Each call records a click, so expect it in your analytics.
  3. Validate analytics under Dashboard → Links → Analytics — you should see clicks, UTMs, and device/geo data.

Once verified, remove Firebase Dynamic Links dependencies from your Podfile/Package manifest. Your iOS build now leans entirely on Ulinkly’s SDK + APIs.