0
0

More than 3 years have passed since last update.

[iOS] URLSchemeで起動した時のAppDelegate/SceneDelegateの呼び出し順序

Last updated at Posted at 2021-08-27

※本記事の前提環境:Xcode 12.5.1

AppDelegate/SceneDelegateを両方実装している場合に、URLSchemeのトリガーによって、URLパラメータ取得系のdelegateメソッドがどのように走るのかを調査しました。

結構メンドクサイなと思いました…

なお、アプリ未起動状態でURLSchemeによってアプリが起動された場合のデバッグについては、以下の記事を参考にさせていただきました。

iOS 13以降

注:URLパラメータ取得系のdelegateメソッド以外については省略しています。

アプリ未起動状態

  1. AppDelegate - application(_ :didFinishLaunchingWithOptions)
  2. SceneDelegate - scene(_ :willConnectTo :options)

※注:scene(_ :openURLContexts)は呼ばれない

アプリ起動状態

  1. SceneDelegate - scene(_ :openURLContexts)

iOS 12以前

アプリ未起動状態

  1. AppDelegate - application(_ :didFinishLaunchingWithOptions)
  2. AppDelegate - application(_ :open :options)

アプリ起動状態

  1. AppDelegate - application(_ :open options)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0