본문으로 건너뛰기
엔지니어링 · · 4분 소요

Ionic 딥 링킹: 완벽한 설정 가이드

작성자 Tolinku 팀
|
Ionic 딥 링킹: 전체 설정 가이드

Ionic 앱은 네이티브 런타임으로 Capacitor(권장)나 Cordova 중 하나를 쓸 수 있어요. 딥 링킹 설정은 둘이 달라요. 하지만 JavaScript에서 URL을 처리하는 방법은 같아요. 이 가이드에서는 두 방식을 모두 다뤄요.

Capacitor 전용 설정은 다음 문서를 참고하세요 Capacitor 딥 링킹: Ionic 앱 설정. 크로스 플랫폼 개요는 다음 글을 참고하세요: 2026년 크로스 플랫폼 딥 링킹 가이드.

Ionic 5 이상부터 Ionic 앱의 권장 런타임은 Capacitor예요. 전체 Capacitor 딥 링킹 가이드 에서 자세한 설정을 확인하세요. 요약은 다음과 같아요:

  1. Xcode에서 Associated Domains 권한을 추가하세요 (applinks:yourdomain.com).
  2. Intent filter 추가 위치: AndroidManifest.xml.
  3. 도메인에 AASA와 assetlinks.json을 호스팅하세요.
  4. 가능하면 @capacitor/app 플러그인의 appUrlOpen 이벤트를 JavaScript에서 처리하세요.
import { App } from '@capacitor/app';

App.addListener('appUrlOpen', (event) => {
  const url = new URL(event.url);
  this.router.navigateByUrl(url.pathname + url.search);
});

Cordova

Ionic 앱이 아직 Cordova를 쓴다면 ionic-plugin-deeplinks 플러그인(또는 cordova-plugin-deeplinks)을 사용하세요:).

설치

ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=yourdomain.com

설정

이 플러그인이 네이티브 설정을 자동으로 수정해요:

  • iOS: Associated Domains 권한을 추가해요.
  • Android: 다음 파일에 Intent filter를 추가해요: AndroidManifest.xml.

그래도 도메인에 AASA와 assetlinks.json을 호스팅해야 해요.

import { Deeplinks } from '@awesome-cordova-plugins/deeplinks/ngx';

constructor(private deeplinks: Deeplinks) {}

initializeDeepLinks() {
  this.deeplinks.route({
    '/products/:productId': 'ProductPage',
    '/offers/:offerId': 'OfferPage',
    '/referral/:referrerId': 'ReferralPage'
  }).subscribe(
    match => {
      console.log('Deep link match:', match.$route, match.$args);
      // 매치 결과에 따라 이동
      this.router.navigate([match.$route], {
        queryParams: match.$args
      });
    },
    nomatch => {
      console.warn('No deep link match:', nomatch.$link);
    }
  );
}

Cordova에서 Capacitor로 마이그레이션

Cordova에서 Capacitor로 옮기는 중이라면:

  1. 프로덕션에서는 ionic-plugin-deeplinks.
  2. 다음 가이드를 따라 하세요 Capacitor 딥 링킹 설정.
  3. Cordova 플러그인의 route() API를 다음으로 바꾸세요: App.addListener('appUrlOpen', ...).
  4. 네이티브 설정(entitlements, Intent filters)은 Capacitor 프로젝트에서 해야 해요.

Ionic Angular 연동

라우트 설정

딥 링크 경로에 맞게 라우트를 정의하세요:

// app-routing.module.ts
const routes: Routes = [
  { path: '', component: HomePage },
  { path: 'products/:productId', component: ProductPage },
  { path: 'offers/:offerId', component: OfferPage },
  { path: 'referral/:referrerId', component: ReferralPage },
  { path: '**', redirectTo: '' }
];
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Platform } from '@ionic/angular';
import { App } from '@capacitor/app';

@Injectable({ providedIn: 'root' })
export class DeepLinkService {
  constructor(
    private router: Router,
    private platform: Platform
  ) {}

  async initialize() {
    // 네이티브 플랫폼에서만 딥 링크를 설정해요
    if (!this.platform.is('capacitor')) return;

    // 콜드 스타트
    const launchUrl = await App.getLaunchUrl();
    if (launchUrl?.url) {
      this.handleUrl(launchUrl.url);
    }

    // 웜 스타트
    App.addListener('appUrlOpen', (event) => {
      this.handleUrl(event.url);
    });
  }

  private handleUrl(urlString: string) {
    try {
      const url = new URL(urlString);
      const path = url.pathname;

      // Angular 라우터로 이동해요
      this.router.navigateByUrl(path + url.search).catch(err => {
        console.error('Navigation failed:', err);
        this.router.navigate(['/']);
      });
    } catch (e) {
      console.error('Invalid deep link URL:', urlString);
    }
  }
}

App 컴포넌트에서 초기화

// app.component.ts
import { Component, OnInit } from '@angular/core';
import { DeepLinkService } from './services/deep-link.service';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit {
  constructor(private deepLinkService: DeepLinkService) {}

  ngOnInit() {
    this.deepLinkService.initialize();
  }
}

Ionic React 연동

// App.tsx
import { useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { App as CapApp } from '@capacitor/app';
import { isPlatform } from '@ionic/react';

const AppDeepLinks: React.FC = () => {
  const history = useHistory();

  useEffect(() => {
    if (!isPlatform('capacitor')) return;

    // 콜드 스타트
    CapApp.getLaunchUrl().then(result => {
      if (result?.url) {
        const url = new URL(result.url);
        history.push(url.pathname + url.search);
      }
    });

    // 웜 스타트
    const listener = CapApp.addListener('appUrlOpen', event => {
      const url = new URL(event.url);
      history.push(url.pathname + url.search);
    });

    return () => { listener.then(l => l.remove()); };
  }, [history]);

  return null;
};

Ionic Vue 연동

// composables/useDeepLinks.ts
import { onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { App } from '@capacitor/app';
import { isPlatform } from '@ionic/vue';

export function useDeepLinks() {
  const router = useRouter();
  let listener: any;

  onMounted(async () => {
    if (!isPlatform('capacitor')) return;

    // 콜드 스타트
    const launchUrl = await App.getLaunchUrl();
    if (launchUrl?.url) {
      const url = new URL(launchUrl.url);
      router.push(url.pathname + url.search);
    }

    // 웜 스타트
    listener = await App.addListener('appUrlOpen', (event) => {
      const url = new URL(event.url);
      router.push(url.pathname + url.search);
    });
  });

  onUnmounted(() => {
    listener?.remove();
  });
}

테스트

브라우저 (개발용)

딥 링크 경로로 바로 이동하세요:

http://localhost:8100/products/abc123

네이티브 (iOS 시뮬레이터)

xcrun simctl openurl booted "https://yourdomain.com/products/abc123"

네이티브 (Android)

adb shell am start -a android.intent.action.VIEW \
  -d "https://yourdomain.com/products/abc123" \
  -c android.intent.category.BROWSABLE

자주 겪는 문제

문제 원인 해결
Android에서는 딥 링크가 동작하는데 iOS에서는 안 돼요 AASA 파일 문제 또는 entitlement 누락 AASA와 Associated Domains 확인
딥 링크 후 라우트를 찾을 수 없음 Angular/React/Vue 라우터가 매칭되지 않음 라우트 경로가 딥 링크 경로와 일치하는지 확인
브라우저에서는 되는데 기기에서는 안 됨 네이티브 설정 누락 entitlements(iOS)와 Intent filters(Android) 확인
콜드 스타트 시 홈 화면이 먼저 보였다가 이동함 이동 타이밍 문제 첫 렌더링 전에 launch URL 처리

Ionic 앱용 Tolinku

Tolinku AASA와 assetlinks.json 호스팅을 제공해서 검증 파일을 직접 관리할 필요가 없어요. Tolinku 웹 SDK는 Ionic 앱에서 스마트 배너와 함께 동작해요.

React Native 딥 링킹은 다음 글을 참고하세요: React Native 딥 링킹: 설정 완전 가이드. 전체 가이드는 다음 글을 참고하세요: 2026년 크로스 플랫폼 딥 링킹 가이드.

딥 링킹 팁을 메일로 받아 보세요

일주일에 한 번만 보내요. 스팸은 없어요.

앱에 딥 링킹을 추가해 볼까요?

유니버설 링크, 앱 링크, 디퍼드 딥 링킹, 분석을 몇 분 만에 설정할 수 있어요. 무료로 시작하세요.