How to handle deferred deep links (Universal Links) in iOS without any third party?

I have a scenario where I need to have a custom solution to open app using Apple’s provided universal links. I have already set up a custom domain and hosted apple-app-site-association file on the root of my custom domain. This AASA file is properly hosted as I have validated it by using [https://branch.io/resources/aasa-validator/%5C](this) link.

After all the development required to do for app id, i.e. enabling associated domain capability and adding it in the Xcode required place my custom domain link successfully open the app if installed and I can easily get the path for any kind of further navigation in the app. I also have added a support on my domain to open app store if the app is not found in the phone. Everything works as expected.

The real problem is when I don’t have app in my phone and my universal link helps me install the app, I want to have my universal link in first launch after installation so that I could do required actions in the app or do necessary navigations if required. This will help me identify which link/campaign/ad has encouraged user to install the app.

There are multiple third parties which help do so and successfully provides the link like Firebase, AppsFlyer, Adjust or Branch. But I want to implement my own solution for that.

Please help me in this regard and suggest how I can achieve it.

Lots of Thanks in advance!

I tried adding a param in my app store link hoping that I would get that link on first launch after installation in AppDelegate’s func application(_, open: URL, options [UIApplication.OpenURLOptionsKey: Any]) method as follows

func application(
        _ app: UIApplication,
        open url: URL,
        options: [UIApplication.OpenURLOptionsKey: Any] = [:]
    ) -> Bool {
    // Here I am expecting that url could be like
    'https://apps.apple.com/app/idYOUR_APP_ID?token={randomly_generated_string}'
}

As I understood from already provided solutions for deferred deep linking that we can have the AppStore link instead of actual universal link in this AppDelegate method and on backend before opening store we would save our universal link against that token above. And on launch of the app that token can be used to fetch actual universal link saved on our backend. But this didn’t happen as I get the following in url param in the above method on first launch after the installation of the app,

{bundle_identifier}://google/link/?request_ip_version=IP_V4&match_message=No pre-install link matched for this device.

And that’s how I am testing this scenario:

  1. I uninstall the app from my device

  2. Click my universal link which directs me to my custom domain hosted page in case the app is not found in the phone.

  3. That page redirects user to App Store to let them install the app first

  4. Then I manually run the app from Xcode on debugger as this implementation is not yet published on the store.

  5. This way it successfully invokes the AppDelegate’s func application(_, open: URL, options [UIApplication.OpenURLOptionsKey: Any]) method on first launch.

Plus, following is my JavaScript code in index.html which I have hosted on my custom domain in order to in order to be used if the app is not installed on the device.

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Open Store</title>
</head>
<body>

<div style="margin: 0 auto; width: 10rem">
    <p style="padding-top: 100px">
        <a href="https://apps.apple.com/us/app/idYOUR_APP_ID?token=1234">
            Open in App Store</a>
    </p>
</div>

<script>
    // Fallback to the App Store if the app is not installed
    window.addEventListener('load', function() {
        setTimeout(function() {
            // Redirect to the App Store after a delay
            window.location.href = "https://apps.apple.com/us/app/idYOUR_APP_ID?token=1234";
        }, 2000);

    });

</script>

</body>

</html>

Here if you see I have hardcoded token=1234 in the App Store url in order to check that either I get this in app delegate on first launch. But no luck.

New contributor

Faraz Raza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật