LoginSignup
0
0

More than 1 year has passed since last update.

iOS UIScene.willEnterForegroundNotificationやUIScene.didEnterBackgroundNotificationはアプリスイッチャーに行った・から戻った 時は呼ばれない

Posted at

A. アプリをアプリスイッチャーに移しただけで端末のホーム画面まで行ってない時は、UIScene.didEnterBackgroundNotificationが呼ばれずUIScene.willDeactivateNotificationのみ呼ばれる。またアプリスイッチャーからアプリを前面に戻した時は、UIScene.willEnterForegroundNotificationが呼ばれずUIScene.didActivateNotificationのみ呼ばれる

-> そのため、UIScene.willEnterForegroundNotificationやUIScene.didEnterBackgroundNotificationを購読しているだけでは、うまく通知を受け取れないことに注意。

B. アプリをバックグラウンドまで戻し端末のホームまで戻ると、UIScene.didEnterBackgroundNotificationとUIScene.willDeactivateNotificationが両方呼ばれる。アプリを端末のホーム画面から全面に戻した時は、UIScene.willEnterForegroundNotificationとUIScene.didActivateNotificationが両方呼ばれる。

参考:iOS 13 起動時/終了時メモ
Detect iOS app entering background

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