[iOS 면접 준비] 앱이 foreground에 있을 때와 background에 있을 때의 제약사항
Foreground Mode
는 메모리 및 기타 시스템 리소스에 높은 우선순위를 가지며 시스템은 이러한 리소스를 사용할 수 있도록 필요에 따라 Background
앱을 종료한다.Background Mode
는 가능한 적은 메모리공간을 사용해야함(시스템 리소스 해제, 메모리에서 해제 후 데이터를 디스크에 작성) 사용자 이벤트를 받기 어렵고 공유 시스템 리소스를 해제하고 이미지 객체 참조 등 메모리 제한not Running
: 앱이 실행되지 않은 상태Foreground
: APp이 실행되어 Client에게 보여지고 있는 상태
Inactive
: 앱이 실행중이지만 아직 아무런 이벤트를 받지 않은 상태이다ex) Foreground 상태에서 전화가 왔을때, 잠금상태, 멀티태스킹 스크린에서 Inactive 상태를 가진다active
: 앱이 실행중이며 현재 이벤트를 받고 있는 상태이다.Background
: 앱이 백그라운에 있는 상태이지만 여전이 실행되고 있는 코드가 있는 상태이다.Suspend
: 앱이 백그라운드에 있고 실행되는 코드가 없는 상태 (App은 여전히 메모리에 존재하며 Suspend 상태가 될 당시의 상태를 저장하고 있지만, CPU나 배터리를 소모하지 않는다. 언제든지 메모리 부족등의 이유로 종료된다.)