Explain iOS App LifeCycle


Q.25 Explain iOS App LifeCycle. Ans:-

  • App Lifecycle events are available in AppDelegate.m file.
  • When we launching the application first time, then control will goes “application:didFinishLaunchingWithOption” method.
  • This method will be called only once when we starts the application.
  • All application related initilization must be take place within this method only.
  • The next method is called during the application launch i.e “ApplicationDidBecameActive”(if URL(Uniform Resource Locator)is not present).
  • This method may be called multiple time.
  • If the URL is available then control will enter info OpenURL or handleOpenURL method,from here control will goes to “ApplicatonDidBecameActive” method.
  • After applicationDidBecameActive mode control will goes to applicationWillEnterForeground method for handling UI events.
  • When user hits Home button or any interruption occures using phone calls or message then controll will goes to applicationWillResignActive method.
  • In this method only we required to pause application related tasks if anything is in running status.
  • From resignActiveMethod controll will goes to applicationDidEnterBackground method. this method can hold only for 5seconds so if we required more than this time, then required to handle “beginBackGroundTaskWithExpirationHandler” method.
  • When the application enter into background if the memory is not available then application terminated by OS.
  • When we double tap the Home button then application will be relaunched, when we are relaunching the application the controll will enter into foreground method, from there openURL or applicationDidBecameActive method will call.
  • Whenever the application is terminating then, applicationWillTerminate method will call.
  • Whenever app having memory related problem then applicationDidReceiveMemoryWarning method will called.
  • In implementation when we are working with push notification services the we require to handle 1)application:didReceiveRemoteNotification 2)application:didReceiveLocalNotification.

Kalavati Technologies Pvt Ltd