Swift

notRunnging 상태에서 링크 및 푸시에서 접근시

반다이크 2023. 1. 17. 16:55
반응형

Appdelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplcation.LaunchOptionsKey: Any]?) -> Bool {
	if let url = launchOptions?[UIApplication.LaunchOptionsKey.url] as? URL {  //링크(ex 카카오)
    	print(url)
    } else if let userInfo = launchOptions?[.remoteNotification] as? [AnyHashable: Any] { // 푸시
    	print(userInfo)
	}
}


SceneDelegate

 public func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        //deepLink
        if let urlContext = connectionOptions.urlContexts.first {
        	print("urlContext: ", urlContext)
        }
        
        //Push
		if let notification = connectionOptions.notificationResponse?.notification.request.content.userInfo {
            if let aps = notification["aps"] as? [String: AnyObject] {

            }
        }
    }
반응형

'Swift' 카테고리의 다른 글

iOS stackView 내 subview UI 변경  (0) 2023.05.31
WKWebView의 UIDelegate completion crash 해결  (0) 2023.03.17
웹뷰 전체 내역 캡쳐 및 앨범 저장  (0) 2023.01.17
Alamofire Swift  (0) 2022.07.15
RxSwift + Alamofire  (0) 2022.07.14