37
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

iOS13 / iOS14 /iOS15 で、AppDelegateのライフサイクルは違うよ 14がおかしいんだけど

Posted at

以前書いた記事

で、OSによってコロコロ変わるライフサイクルに苦しめられてることをぼやかずに分析だけしたのですが、iOS15でもまたまたライフサイクルが変わっています。いい加減にしてほしい!

結論から言うと、iOS14だけおかしかったのです。iOS13もか。
iOS15では、iOS12以前のライフサイクルに戻っているようです。

iOS15

-[AppDelegate application:didFinishLaunchingWithOptions:]
-[ViewController viewDidLoad]
-[ViewController viewWillAppear:]
-[ViewController viewDidAppear:]
-[AppDelegate applicationDidBecomeActive:]
-[ViewController applicationDidBecomeActiveNotification:]

iOS14(iOS14.5)

-[AppDelegate application:didFinishLaunchingWithOptions:]
-[AppDelegate applicationDidBecomeActive:]
-[ViewController viewDidLoad]
-[ViewController viewWillAppear:]
-[ViewController viewDidAppear:]

viewDidLoadとかで applicationDidBecomeActiveNotification へのObserverを貼ったところで、既にapplicationDidBecomeActiveは呼ばれているので、初回はapplicationDidBecomeActiveNotificationを受け取れない!

iOS13

-[AppDelegate application:didFinishLaunchingWithOptions:]
-[ViewController viewDidLoad]
-[ViewController viewWillAppear:]
-[AppDelegate applicationDidBecomeActive:]
-[ViewController applicationDidBecomeActiveNotification:]
-[ViewController viewDidAppear:]

iOS11 / iOS12

-[AppDelegate application:didFinishLaunchingWithOptions:]
-[ViewController viewDidLoad]
-[ViewController viewWillAppear:]
-[ViewController viewDidAppear:]
-[AppDelegate applicationDidBecomeActive:]
-[ViewController applicationDidBecomeActiveNotification:]

37
30
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
37
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?