프로젝트 하면서 정말 짜증나게 했던 녀석임.. ㅜㅜ

간단하면서 간단하지 않은 짜증났던 경험 이었네요.

 

[주의사항]

1. 개발하는 웹서버 환경이 외부에서 접근이 안되는 폐쇄망일 경우 안됨.

2. apple-app-site-association 파일을 서버에 올리고 바로 적용되는게 아님.

(애플 CDN에서 땡겨가는 주기가 어떻게 되는지 모르겠지만. 제가 테스트 했을때는 30분에서 반나절도 걸렸던거 같습니다.)

3. apple-app-site-association 파일 변경하면 앱을 삭제 후 다시 설치해야 적용되는듯 함.

(확실하지 않지만 삭제 후 재설치하니 적용됬음)

4. 웹서버에서 apple-app-site-association 파일 속성은 JSON으로 해야됨.

(웹서버 엔진 종류에 따라 설정 방법이 달라 이건 설명 불가)

 

작업은 두가지로 진행 됩니다.

 

첫번째. 서버 설정 방법

두번째. XCode 설정 및 소스 추가

 

XCode 설정 및 소스 추가 방법은 다른 블러그에 많아서 서버 설정 방법을 위주로 설명 해 놓겠음..

XCode 설정 및 소스 추가 방법은 여기 블러그 참고하시라..

https://yoojin99.github.io/app/Universal-Link/

 

[iOS] - Universal Link

Universal Link

yoojin99.github.io

 

 

 

프로젝트 앱이 IOS 13 미만도 지원한다면 두 군데에 apple-app-site-association 파일을 위치 시켜야 되는데 JSON 형태가 다름.

 

< 서버 설정 >

 

[IOS 13이상]

웹서버의 루트에 .well-known 폴더에 apple-app-site-association JSON 타입의 파일을 위치시키면됨.

https://xxxxxxxxxx.co.kr/.well-known/apple-app-site-association

 

 

["1234E4CKLX.kr.xxx.xxxxxxxxx"]   설명

1234E4CKLX : Apple Team ID

kr.xxx.xxxxxxxxx : Project Bundle ID

 

"/": "/static/pages/*"  이렇게 설정하면 어떻게 동작 하냐면...

 

https://xxxxxxxxxx.co.kr/static/pages/test1.html

https://xxxxxxxxxx.co.kr/static/pages/test2.html

 

웹페이지에서 링크를 클릭했는데 이동하는 주소에 /static/pages/ 폴더가 들어가면 위에 예시처럼 포함되면 앱을 실행해서 해당 페이지가 앱에서 열리는 구조임. 

 

IOS 13이상 일 경우 apple-app-site-association 파일 구조

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appIDs": ["1234E4CKLX.kr.xxx.xxxxxxxxx"],
        "components": [
            {
                "/": "/static/pages/*"
            }
        ]
      }
    ]
  }
}

 

[IOS 12이하]

https://xxxxxxxxxx.co.kr/apple-app-site-association

 

IOS 12이하 일 경우 apple-app-site-association 파일 구조

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "1234E4CKLX.kr.xxx.xxxxxxxxx",
        "paths": ["*"]
      },
      {
        "appID": "1234E4CKLX.kr.xxx.xxxxxxxxx",
        "paths": ["/static/pages/*"]
      }
    ]
  }
}

 

 

*** 구글의 경우 웹서버 루트에 통합해서 구성한걸로 보임. 

IOS 12이하 구조와 13이상 구조를 통합해서 사용하고 있었는데 테스트는 안해봤음. 확인하고 싶으신 분들은 아래링크 클릭.

https://www.google.co.kr/apple-app-site-association

 

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "1234E4CKLX.kr.xxxx.insurance",
        "paths": ["/static/pages/open.html"]
      },
      {
        "appIDs": ["1234E4CKLX.kr.xxxx.insurance"],
        "components": [
            {
                "/": "/static/pages/open.html"
            }
        ]
      }
    ]
  }
}

 

 

서버에 적용 후 재대로 적용 됬는지 확인하는 방법

 

$curl -v https://app-site-association.cdn-apple.com/a/v1/m.xxxxxx.co.kr

[결과값]

아래처럼 구성한 JSON 데이터가 표시되야됨. 404, 400 이런 에러 나면 적용 안된거임. 다시 말하지만 수정하고 한참 기다려야 적용되니 수정하고 확인했는데 안된다고 또 수정하고 하지말고 수정했으면 30분에서 반나절 정도 기다렸다가 다시 확인하시길...

 

예제를 보고 싶으면 구글이나 페이스북 도메일을 넣으면 잘 보입니다.

$curl -v https://app-site-association.cdn-apple.com/a/v1/google.com


*   Trying 146.75.51.6:443...
* Connected to app-site-association.cdn-apple.com (146.75.51.6) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: C=US; ST=California; O=Apple Inc.; CN=app-site-association.cdn-apple.com
*  start date: May 27 13:42:04 2024 GMT
*  expire date: Nov 23 13:52:04 2024 GMT
*  subjectAltName: host "app-site-association.cdn-apple.com" matched cert's "app-site-association.cdn-apple.com"
*  issuer: C=KR; O=Somansa; CN=Somansa Root CA
*  SSL certificate verify ok.
* using HTTP/1.1
> GET /a/v1/m.xxxxxxxx.co.kr HTTP/1.1
> Host: app-site-association.cdn-apple.com
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Length: 252
< Apple-From: https://m.xxxxxx.co.kr/.well-known/apple-app-site-association
< Apple-Origin-Format: json
< Cache-Control: max-age=21600,public
< Content-Type: application/json
< Via: https/1.1 jptyo12-3p-pst-011.ts.apple.com (acdn/153.14426), https/1.1 jptyo12-3p-pac-023.ts.apple.com (acdn/153.14426), https/1.1 jptyo12-3p-pfe-012.ts.apple.com (acdn/153.14426), 1.1 varnish
< CDNUUID: 282b98fd-f89c-4a81-9933-9f2f4dd09967-133582759
< Accept-Ranges: bytes
< Age: 0
< Date: Thu, 20 Jun 2024 04:46:56 GMT
< x-cdn: fsly
< X-Served-By: cache-icn1450075-ICN
< X-Cache: hit-stale, hit-stale, hit-stale, MISS
< X-Cache-Hits: 0
< X-Timer: S1718858817.561580,VS0,VE309
<
{
  "applinks": {
    "details": [
      {
        "appIDs": [
        	"1234E4CKLX.kr.xxxx.xxxxxxxxx"
        ],
        "components": [
            {
                "/": "/static/pages/*"
            }
        ]
      }
    ]
  }
* Connection #0 to host app-site-association.cdn-apple.com left intact
}%

 

여기까지 적용된게 확인됬으면 앱이 설치되어 있다면 앱을 삭제 후 재설치 하고 링크 테스트 해보시길...

+ Recent posts