An iOS app starts with a call to the
UIApplicationMain method, with a reference to the
UIApplicationDelegate class. The delegate receives application scope events and has a definitive lifecycle with the
application:didFinishLaunchingWithOptions: method indicating the application startup. It is in this method that initialization of key components such as crash reporting, network, logging, and instrumentation happen. In addition, there may be one-time initialization during the first launch or restoring of previous state for subsequent launches.
The app window has a
rootViewController that drives the user interface presented to the user. The corresponding
UIViewController object also has a definitive lifecycle.
A flurry of activities during application startup has an impact on initial load time, which must be minimized for a better user experience. However, the tasks should not be removed to the extent that operations after app launch take much longer, as this will only further annoy users.
This chapter takes a deep dive into the application lifecycle. We will compare what app developers use an event callback for versus its primary intent and its impact on app performance. We also review some techniques, tips, and tricks that we can use to keep our users happy.
We will explore the
UIViewController lifecycle in Chapter 6.
The app delegate will, generally, be the first object to be created in your app. It is this class that gets inputs ...