> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deeplink.in/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS setup

> Configure Associated Domains and URL handling for DeepLink

To open your app from DeepLink links on iOS and attribute installs, you need **Associated Domains** and optional **Universal Links** configuration.

## 1. Associated Domains entitlement

1. In Xcode, select your app target and open **Signing & Capabilities**.
2. Click **+ Capability** and add **Associated Domains**.
3. Add your DeepLink domain in this form:
   * `applinks:your-domain.com`
     Replace `your-domain.com` with the host you use in the DeepLink dashboard (e.g. your app’s subdomain).

In the project, this is stored in `ios/Runner/Runner.entitlements` (or your custom entitlements file):

```xml theme={null}
<key>com.apple.developer.associated-domains</key>
<array>
  <string>applinks:your-domain.com</string>
</array>
```

## 2. Apple App Site Association (AASA)

DeepLink automatically hosts the required Apple App Site Association (AASA) file on your link domain (managed or custom) once you configure your app’s bundle ID and Apple Team ID in the dashboard. You don’t need to create or host this file yourself.

## 3. Initialize the SDK

In your Flutter app, call the DeepLink SDK `init` with your API key (and optional base URL) as shown in [Quickstart](/quickstart). On iOS, since there is no install referrer like Android, the backend:

* Looks at recent clicks for this user/device.
* Computes a **score** based on IP (including partial matches), country, city, platform, OS version, and deviceId (when present).
* Picks the best-matching click above a minimum score and attributes the install to that link (including its UTM and campaign data).

## 4. Test on device

Universal Links often do not work in the simulator. Test on a real device:

1. Install the app from Xcode (or TestFlight).
2. Open a DeepLink link in Safari (or Messages) — do not paste the link in the address bar; use a tap from another page or app.
3. The app should open if the domain and AASA are correct.

## Troubleshooting

* **Link opens in Safari instead of the app** — Confirm the entitlement domain matches the link host exactly (no `https://`, no path). Ensure the AASA file is at `/.well-known/apple-app-site-association` and returns the correct `Content-Type` (e.g. `application/json`).
* **Install not attributed** — The backend matches by IP and recent click; ensure the Track Install (or SDK) call runs on first launch and that the user actually clicked a DeepLink link before installing.

<Card title="Handling links" icon="link" href="/sdk/handling-links">
  Handle incoming deep link URLs in your app.
</Card>
