01 – What is the first opportunity for app to execute code

When you create a new project, Xcode creates an AppDelegate file with six UIApplicationDelegate delegate delegate methods in it by default, Is one of the first application: didFinishLaunchingWithOptions: we usually for the SDK initialization here and some other configuration, etc. But the app the first chance to execute the code is actually application: willFinishLaunchingWithOptions:, official annotations are:

This method is your app’s first chance to execute code at launch time.

This knowledge can be used for interviews, as well as bug hunting for SDK configurations that require initialization timing.


02 – Which callback should store data in

applicationDidEnterBackground



applicationDidEnterBackground:
Will this method still be called if you press the home button and then swipe to kill the app?

State changes in an iOS app

The answer is, the application from the active state to the suspended state, is must pass a background condition, we should according to the official standard, the applicationDidEnterBackground: Methods rather than in applicationWillResignActive may be called more: method protected storage for data inside.


Reference links: developer.apple.com/library/con…