# アプリケーションのライフサイクル (iOS) > アプリの状態、AppDelegate、SceneDelegate、background modes、アプリの終了 - 20 面接問題 - Junior - [面接問題: iOS](https://sharpskill.dev/ja/technologies/ios/interview-questions.md) ## 1. UIApplicationDelegateとは何ですか? **回答** UIApplicationDelegateは、アプリケーションのライフサイクルのコールバックメソッドを定義するプロトコルです。起動、バックグラウンドへの移行、フォアグラウンドへの遷移などの重要なイベントに応答できます。すべてのiOSアプリケーションは、ライフサイクルを正しく管理するために、AppDelegateクラスでこのプロトコルを実装する必要があります。サードパーティサービスの初期化、通知の設定、グローバルな状態遷移の管理を行う中心的なポイントです。iOS 13以降、このプロトコルは複数のウィンドウを管理するためにSceneDelegateと責務を分担します。 ## 2. application(_:didFinishLaunchingWithOptions:)メソッドはいつ呼び出されますか? **回答** このメソッドは、UIApplicationの初期化後、ユーザーインターフェースが表示される前の、アプリケーションの起動時に呼び出されます。サードパーティサービスの初期化、データベースの設定、通知の登録、グローバルパラメータの設定に最適なタイミングです。初期表示が遅れるため、長い処理は避けるべきです。 ## 3. iOSアプリケーションのライフサイクルにおける主な状態は何ですか? **回答** ライフサイクルには5つの主要な状態があります。Not Running(アプリが起動していない、または終了した)、Inactive(アプリはフォアグラウンドにあるがイベントを受け取っていない、一時的な中断)、Active(アプリが正常に動作しイベントを受け取っている)、Background(アプリがバックグラウンドで実行され、サスペンドまで約30秒)、Suspended(アプリがメモリ内で凍結され、実行されていない)です。これらの状態を理解することで、リソース、権限を適切に管理し、バッテリーを最適化できます。これらの状態間の遷移により、AppDelegateまたはSceneDelegateのメソッドが呼び出されます。 ## さらに17問利用可能 - applicationWillResignActiveとapplicationDidEnterBackgroundの違いは何ですか? - applicationDidBecomeActiveの役割は何ですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のiOS面接トピック - [Swift の基礎](https://sharpskill.dev/ja/technologies/ios/interview-questions/swift-basics.md): 25問, Junior - [Swift言語の基礎](https://sharpskill.dev/ja/technologies/ios/interview-questions/swift-language-essentials.md): 15問, Junior - [UIKit の基礎](https://sharpskill.dev/ja/technologies/ios/interview-questions/uikit-fundamentals.md): 18問, Junior - [UIViewControllerのライフサイクル](https://sharpskill.dev/ja/technologies/ios/interview-questions/uiviewcontroller-lifecycle.md): 20問, Junior - [UserDefaults & Keychain](https://sharpskill.dev/ja/technologies/ios/interview-questions/userdefaults-keychain.md): 20問, Junior - [Auto Layout & Constraints](https://sharpskill.dev/ja/technologies/ios/interview-questions/auto-layout-constraints.md): 24問, Mid-Level - [UITableView & UICollectionView](https://sharpskill.dev/ja/technologies/ios/interview-questions/uitableview-uicollectionview.md): 25問, Mid-Level - [SwiftUIの基礎](https://sharpskill.dev/ja/technologies/ios/interview-questions/swiftui-basics.md): 18問, Mid-Level - [SwiftUI の状態管理](https://sharpskill.dev/ja/technologies/ios/interview-questions/swiftui-state-management.md): 22問, Mid-Level - [SwiftUI ナビゲーション](https://sharpskill.dev/ja/technologies/ios/interview-questions/swiftui-navigation.md): 18問, Mid-Level - [Networking & URLSession](https://sharpskill.dev/ja/technologies/ios/interview-questions/networking-urlsession.md): 20問, Mid-Level - [Codable と JSON パース](https://sharpskill.dev/ja/technologies/ios/interview-questions/codable-json-parsing.md): 20問, Mid-Level - [Core Data](https://sharpskill.dev/ja/technologies/ios/interview-questions/core-data.md): 22問, Mid-Level - [プロトコル指向プログラミング](https://sharpskill.dev/ja/technologies/ios/interview-questions/protocol-oriented-programming.md): 20問, Mid-Level - [MVVMアーキテクチャ](https://sharpskill.dev/ja/technologies/ios/interview-questions/mvvm-architecture.md): 20問, Mid-Level - [プッシュ通知](https://sharpskill.dev/ja/technologies/ios/interview-questions/push-notifications.md): 18問, Mid-Level - [ユニットテストとXCTest](https://sharpskill.dev/ja/technologies/ios/interview-questions/unit-testing-xctest.md): 20問, Mid-Level - [UIテスト](https://sharpskill.dev/ja/technologies/ios/interview-questions/ui-testing.md): 18問, Mid-Level - [Xcode とビルドシステム](https://sharpskill.dev/ja/technologies/ios/interview-questions/xcode-build-system.md): 16問, Mid-Level - [Swift Package Manager](https://sharpskill.dev/ja/technologies/ios/interview-questions/swift-package-manager.md): 16問, Mid-Level - [Memory Management & ARC](https://sharpskill.dev/ja/technologies/ios/interview-questions/memory-management-arc.md): 22問, Senior - [Combine Framework](https://sharpskill.dev/ja/technologies/ios/interview-questions/combine-framework.md): 24問, Senior - [Concurrency & async/await](https://sharpskill.dev/ja/technologies/ios/interview-questions/concurrency-async-await.md): 26問, Senior - [iOS Design Patterns](https://sharpskill.dev/ja/technologies/ios/interview-questions/ios-design-patterns.md): 24問, Senior - [パフォーマンス最適化](https://sharpskill.dev/ja/technologies/ios/interview-questions/performance-optimization.md): 22問, Senior - [セキュリティと暗号化](https://sharpskill.dev/ja/technologies/ios/interview-questions/security-encryption.md): 20問, Senior - [SwiftUI Advanced](https://sharpskill.dev/ja/technologies/ios/interview-questions/swiftui-advanced.md): 22問, Senior - [iOSアプリケーションアーキテクチャ](https://sharpskill.dev/ja/technologies/ios/interview-questions/ios-app-architecture.md): 22問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/ios/interview-questions/app-lifecycle