Swift

URL Scheme 딥링크

반다이크 2022. 2. 25. 15:40
반응형

1.  받는쪽 셋팅

1. URL Type 정의


2. URL 체크

- AppDelegate 사용시

포그라운드

funcapplication(_app:UIApplication,openurl:URL,options: [UIApplication.OpenURLOptionsKey:Any] = [:]) ->Bool { } 사용

 

약속된 데이터가 2개일때

NotRunning 상태

didFinishLaunchingWithOptions


link: launchOptions?[UIApplication.LaunchOptionsKey.url] as? URL 

push: userInfo = launchOptions?[.remoteNotification] as? [AnyHashable: Any]



- SceneDelegate 사용시

포그라운드

 

NotRunning 상태

willConnectTo



* host는 어떤 목적으로 들어왔는지 구분할때 쓰는데 여기서는 무시해주세요.

 

2. 보내는 쪽 셋팅

1. info plist

info plist에 보낼 App의 URL Scheme을 추가해주세요. 

 

LSApplicationQueriesSchemes or Queried URL Schemes

 

 

2. canOpenUrl 사용

 

버튼 클릭 이벤트로 진행

host: 목적 구분용

 

이상입니다.

반응형

'Swift' 카테고리의 다른 글

iOS 페이스북 로그인  (0) 2022.02.26
iOS 네이버 로그인  (0) 2022.02.26
iOS 카카오 로그인  (0) 2022.02.26
FCM, APNS 연동 방법  (3) 2022.02.25
Firebase Dynamic Link  (0) 2022.02.25