본문 바로가기
#모바일 [Mobile]/iOS

[iOS] 애플리케이션 생명 주기 (Application Life Cycle)

by cy_mos 2021. 11. 4.
반응형
카테고리 (Category) 작성 날짜 (Write Date) 최근 수정 날자 (Recent Write Date) 작성자 (Writer)
iOS 2021-11-04 20:49 2021-11-09 23:34:10  Dev.Yang

 

🛠 애플리케이션 상태 (Application State)

 

Managing Your App's Life Cycle

 

✏️ 기타상태

  • Not Running - 애플리케이션이 실행되고 있지 않은 상태 [Not Memory allocation]

✏️ 포그라운드 (Foreground)

  • Active - 애플리케이션이 구동이 되어 실질적으로 사용자와 상호작용이 이루어지고 있는 상태 [Memory Allocation]
  • InActive - 애플리케이션이 구동이 되고 있으나 사용자와 상호작용이 이루어지고 있지 않은 상태 [Memory Allocation]

✏️ 백그라운드 (Background)

  • Background - 애플리케이션이 UI에 표시되지 않은 상태로 작업 중인 상태입니다. 또한, 운영체제에서 허가 된 기능만 동작할 수 있습니다. [Memory allocation]
  • Suspend - 애플리케이션이 대기 중인 상태로 실질적으로 동작하지 않고 있는 상태입니다. 또한, 운영체제에서 메모리가 부족한 경우 func applicationWillTerminate(UIApplication) 호출하여 정상적으로 종료시킵니다. [Memory allocation]

 

* 외부적인 조건 (Interrupt)으로 애플리케이션은 InActive 상태로 변경이 될 수 있습니다.

* 백그라운드 (Background)에서 허용되는 작업은 아래와 같습니다.


🛠 AppDelegate Delegate

 

- application (_:willFinishLaunchingWithOptions:)

애플리케이션이 실행이 되고 main storyboard 또는 nib 파일이 로드가 되었을 경우 호출되는 함수입니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        return true
    }

application (_:didFinishLaunchingWithOptions:)

애플리케이션이 실행이 된 후 이 사용자에게 화면이 표시되기 전에 호출되는 함수입니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

- applicationDidBecomeActive(_:)

애플리케이션이 비활성화 (In-Active) 상태에서 활성화 (Active) 상태가 되었을 경우 호출되는 함수입니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func applicationDidBecomeActive(_ application: UIApplication) {
    }

- applicationWillResignActive(_:)

애플리케이션이 활성화 (Active) 상태에서 비활성화 (In-Active) 상태가 되었을 경우 호출되는 함수입니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func applicationWillResignActive(_ application: UIApplication) {
    }

- applicationDidEnterBackground(_:)

애플리케이션이 백그라운드 (Background) 상태가 되었을 경우 호출되는 함수입니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func applicationDidEnterBackground(_ application: UIApplication) {
    }

- applicationWillEnterForeground(_:)

애플리케이션이 포그라운드 (Foreground) 상태가 되었을 경우 호출되는 함수입니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func applicationWillEnterForeground(_ application: UIApplication) {
    }

- applicationWillTerminate(_:)

애플리케이션이 종료가 되기 직전에 호출되는 함수입니다. 하지만, 사용자가 애플리케이션을 강제로 종료하는 경우에는 호출되지 않습니다.

 

추가적인 정보는 아래의 더보기를 통하여 확인해주세요.

더보기

🗂 SourceCode

func applicationWillTerminate(_ application: UIApplication) {
    }

🚀 REFERENCE

 

Apple Developer Documentation

 

developer.apple.com

 

Apple Push Notification service - Wikipedia

Apple Push Notification service (commonly referred to as Apple Notification Service or APNs) is a platform notification service created by Apple Inc. that enables third party application developers to send notification data to applications installed on App

en.wikipedia.org

 

반응형

댓글