※本記事の前提環境:Xcode 12.5.1
AppDelegate/SceneDelegateを両方実装している場合に、URLSchemeのトリガーによって、URLパラメータ取得系のdelegateメソッドがどのように走るのかを調査しました。
結構メンドクサイなと思いました…
なお、アプリ未起動状態でURLSchemeによってアプリが起動された場合のデバッグについては、以下の記事を参考にさせていただきました。
iOS 13以降
注:URLパラメータ取得系のdelegateメソッド以外については省略しています。
アプリ未起動状態
- AppDelegate - application(_ :didFinishLaunchingWithOptions)
- SceneDelegate - scene(_ :willConnectTo :options)
※注:scene(_ :openURLContexts)は呼ばれない
アプリ起動状態
- SceneDelegate - scene(_ :openURLContexts)
iOS 12以前
アプリ未起動状態
- AppDelegate - application(_ :didFinishLaunchingWithOptions)
- AppDelegate - application(_ :open :options)
アプリ起動状態
- AppDelegate - application(_ :open options)