카테고리 없음

[App Life-cycle]

s.usu 2021. 9. 22. 16:49

Application Life-cycle

1) App-Based Life-cycle (iOS 12 and earlier)

iOS 12 이전은 App-Based Life-cycle을 가진다.

 

2) Scene-Based Life-cycle (iOS 13 and later)

iOS 13 이상부터 Scen-Based Life-cycle을 가진다.

 

Scene? (더 공부 필요!)

Scene-Based Life-cycle부터 scene이라는 개념이 등장한다. iOS 13부터 멀티 윈도우가 가능해지면서 생긴 개념이다. Scene에는 window와 view controller가 있다. 또, 각 scene에 해당하는 UIWindowSceneDelegate 객체를 갖고 있다.

Apple Document | Scenes 를 참고한다.

 

UISceneSession? (더 공부 필요!)

AppDelegate에서는 UISceneSession을 통해 scene에 대한 정보를 받는다. UISceneSession 객체는 scene의 고유의 런타임 인스턴스를 관리한다.

Apple Document | UISceneSession 를 참고한다.

 

State

출처https://developer.apple.com/documentation/uikit/app_and_environment/managing_your_app_s_life_cycle

  • Unattached : 사용자가 요청한 Scene이 연결되지 않은 상태
  • Foreground Inactive : app이 foreground에서 실행 중이지만 아직 event를 받지 않은 상태
  • Foreground Active : app이 foreground에서 실행중이며 event를 받고 있는 상태
  • Background : 메모리에 app이 올라간 상태이지만 사용자가 app을 full control 수 없는 상태
  • Background (Running) : app이 background에서 실행 중인 상태. iOS에서는 background에서의 동작이 제한적이며 만약 특정 시간 내에 동작을 완료하면 Suspended 상태로, 완료하지 못하면 timeout으로 Unattached 상태로 간다.
  • Suspended : background에서 app이 동작하지 않는 상태. background에서 suspended 상태인 app이 쌓이면 메모리 때문에 Unattached 상태로 간다.

출처 https://developer.apple.com/documentation/uikit

 

Delegate

1) App Delegate?

 

2) Scene Delegate?

iOS 13 and later

 

출처 https://qiita.com/KenNagami/items/cbbe98b736fbdb24fef8

 

[참고]

https://lena-chamna.netlify.app/post/appdelegate_and_scenedelegate/

 

[iOS] AppDelegate와 SceneDelegate

iOS 13 이후 AppDelegate와 SceneDelegate

lena-chamna.netlify.app

https://ios-development.tistory.com/53

 

[iOS - SceneDelegate] iOS13이상 버전의 SceneDelegate

1. iOS12이하 버전 : App하나는 오로지 각각 하나의 Process와 UI를 유지 (AppDelegate에서 모두 관여) - Process Lifecycle : Process 상태 - UI Lifecycle : active, inactive, background, foreground 상태 관..

ios-development.tistory.com