Deferred deep links let you send users to specific screens after they install your iOS app, even if they didnāt have the app installed when they clicked the link. This creates a smooth user experience and is a powerful tool for marketing, onboarding, and referrals.
In this guide, youāll learn:
What deferred deep links are
How to handle custom URL schemes and Universal Links
How to capture Smlerās install referral data
How to route users based on parameters
š What Is a Deferred Link?
When a user clicks a Smler deferred link and installs your iOS app:
The link data is stored temporarily by Smler.
After install, the app hits an endpoint to fetch install details.
The app uses that data to navigate to the right screen.
Letās implement this in Swift.
š§© Step 1: Register Your Custom Scheme in Xcode
In Xcode:
Go to your app target ā Info tab.
Scroll down to URL Types.
Click + to add a new URL Type.
Enter the following:
Identifier: anything like
com.smler.link
URL Schemes:
smler
(ormyawesomeapp
, etc.)
Your app will now respond to links like:
smler://offers?page=123
š² Step 2: Handle Incoming Links in AppDelegate
In your AppDelegate.swift
, implement the open url
method:
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
print("Received URL: \(url)")
// Parse path or query
if let components = URLComponents(url: url, resolvingAgainstBaseURL: false) {
if let page = components.queryItems?.first(where: { $0.name == "page" })?.value {
navigateTo(page: page)
} else {
navigateTo(path: url.path)
}
}
return true
}
You can also route using the URL path like /offers/123
.
š§ Step 3: Call Smlerās Deferred Install API on First Launch
When the app is launched for the first time, you need to ping Smler to retrieve the install referral data.
Hereās how to do that:
ā Add This in Your Initial View or Launch Logic:
import Foundation
class DeferredLinkManager {
static func fetchDeferredInstallData() {
let hasFetched = UserDefaults.standard.bool(forKey: "hasFetchedDeferredInstall")
if hasFetched {
print("Already fetched deferred install")
return
}
guard let url = URL(string: "https://smler.in/api/v1/deferred-link/install?device=ios") else { return }
let task = URLSession.shared.dataTask(with: url) { data, response, error in
guard error == nil, let data = data,
let responseString = String(data: data, encoding: .utf8) else {
print("Deferred install fetch failed")
return
}
print("Deferred install data: \(responseString)")
DispatchQueue.main.async {
handleDeferredLink(responseString)
UserDefaults.standard.set(true, forKey: "hasFetchedDeferredInstall")
}
}
task.resume()
}
}
š§ Example of Handling a Deferred Link
func handleDeferredLink(_ link: String) {
guard let url = URL(string: link) else { return }
if let components = URLComponents(url: url, resolvingAgainstBaseURL: false),
let page = components.queryItems?.first(where: { $0.name == "page" })?.value {
navigateTo(page: page)
} else {
navigateTo(path: url.path)
}
}
Call DeferredLinkManager.fetchDeferredInstallData()
during your splash screen or app launch.
š§ Step 4: (Optional) Support Universal Links (HTTPS)
If youāre using https://smler.in/...
URLs, youāll need to:
Add
Associated Domains
capability.Add this entry:
applinks:smler.in
Ensure Smler hosts the apple-app-site-association file (you can request this).
Then handle links in SceneDelegate.swift
:
func scene(_ scene: UIScene,
continue userActivity: NSUserActivity) {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let incomingURL = userActivity.webpageURL else {
return
}
print("Universal Link URL: \(incomingURL)")
// Parse and route
handleDeferredLink(incomingURL.absoluteString)
}
š Best Practices
ā Call the install API only once and store a flag using
UserDefaults
.š« Avoid hardcoding link formats ā always parse using
URLComponents
.š§Ŗ Test using real devices with real installs (App Store builds or TestFlight).
š§Ŗ Example Link You Can Generate in Smler
smler://offers?page=welcome2025
Or:
https://smler.in/offers?page=welcome2025
Both can be deferred, and once your app is installed, the user will be routed accordingly.
š Wrap Up
Integrating Smlerās deferred deep links in iOS is lightweight and doesnāt require third-party SDKs. Using Appleās built-in support for custom schemes and universal links, you can route users to the right place, even after an app install.
Start generating links now:
š https://app.smler.in/app/deferred-link
Have questions or need a sample Xcode project? Drop us a message. Weād love to help you get started!