iOS/iOS

iOS) Universal link

Brad_Heo 2024. 12. 12. 13:04

웹에서 앱을 호출해야할 경우가 있을 떄 사용

  • ex) 웹 배너 광고 - 광고 클릭 시 설치 페이지 또는 앱 이동

준비해야할 것

  1. AASA 파일
  2. Capability

1. AASA (apple-app-site-association)

파일 추가 위치

파일 예시

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appIDs": [
                    "ABTWV6HNWN.com.tmonet.BubiNFC"
                ],
                "components": [
                    {
                        "/": "/test/*",
                        "comment": "Matches any URL whose path is /test/* and instructs the system to open it as a Universal link"
                    },
                    {
                        "/": "/event/*",
                        "exclude": true,
                        "comment": "Matches any URL whose path is /event/* and instructs thw system NOT to open it as a Universal link"
                    }
                ]
            }
        ]
    }
}

appIDs - 팀 ID + Bundle ID
components - "/"값에 특정 path값에만 실행 시키거나, 동작되지 못하게 설정(모든 URL을 허용한다면 `"*")

2. Capability

Xcode - TARGETS -> Signing & Capabilities -> Associated Domains

도메인 설정
ex) applinks:test.com, applinks:testsite.com

테스트

AASA 파일 등록 후 Domain까지 등록되면 테스트 가능

주의사항

  • Apple CDN에 등록되어야 테스트 가능
    • 등록 되어있는지 확인 방법 - 링크
    • 링크 클릭 후 맨 뒤 path값 등록한 domain으로 설정
      • ex) https://app-site-association.cdn-apple.com/a/v1/test.com
    • 웹서버에 새로운 AASA파일을 새로 반영한다고 해도, Apple CDN도 업데이트 되지 않음. 확실하진 않지만, 하루에 한 번 업데이트 되는 것 같음.
  • Apple CDN에 등록 전 테스트 방법
    • 웹서버에 수정된 AASA파일이 반영되어 있는지 확인
    • Domain 등록할떄 모드 설정
      • ex) applinks:test.com?mode=developer

웹서버 AASA 파일 반영 확인 사이트
https://branch.io/resources/aasa-validator/

참고 사이트

https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.associated-domains

'iOS > iOS' 카테고리의 다른 글

iOS) 앱 배포 - 빠른(긴급) 심사  (0) 2024.12.16
iOS) XCFramework 생성  (0) 2024.04.22
음성 녹음, 재생  (0) 2023.09.04
iOS) UIVisualEffectBackdropView 제거  (0) 2023.07.17
iOS) UIViewController  (0) 2022.12.06