App lifecycle for iOS devs

App lifecycle for iOS devs

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

Both iOS and Windows Store apps have a specific set of methods and events that are called or triggered as an app starts up and shuts down. Here's a comparison.

Although there isn't an exact 1:1 correlation between methods or when they are called during an app's lifecycle, the following methods and events will help you get an idea of what exist to help you launch your app. You should also read up on the Application lifecycle and Running code in the background.

Events associated with an app starting and ending

iOS EventWindows 8 App Event equivalent
application:didFinishLaunchingWithOptions Application.OnLaunched (or sometimes Application.OnActivated). On Windows Phone, OnLaunched is called each time the user launches the app from Start tile or app list, even when the app is currently suspended in memory. On Windows, launching a suspended app from Start tile or app list doesn’t call this method.
applicationDidBecomeActive Application.OnLaunched (or Application.Start, but you rarely need to call this method specifically).
applicationWillEnterForeground: (UIApplication *)application Application.OnResuming
applicationDidEnterBackground: (UIApplication *)application Application.OnSuspending
applicationWillEnterBackground:(UIApplication *)application Application.OnSuspending
applicationWillResignActive:(UIApplication *)application Application.OnSuspending
applicationWillTerminate:(UIApplication *)applicationNo direct equivalent event is available. Application.UnhandledException may be useful depending on the specific scenario.
applicationDidReceiveMemoryWarning:(UIApplication *)applicationNo direct equivalent event is available. Application.UnhandledException may be useful depending on the specific scenario.

 

Events associated with a view, window or page opening and closing

iOS EventWindows 8 App Event equivalent
initWithNibName Page.Page constructor
loadView FrameworkElement.Loaded event
ViewDidLoad FrameworkElement.Loaded event
ViewWillAppear: (BOOL)animated Page.OnNavigatedTo
ViewDidAppear: (BOOL)animated Page.OnNavigatedTo
ViewWillDisappear: (BOOL)animated Page.OnNavigatingFrom
ViewDidDisappear: (BOOL)animated Page.OnNavigatedFrom
ViewDidUnload FrameworkElement.Unloaded event
didRotateFromInterfaceOrientation orientationchanged event

 

Related topics

Topics for iOS devs
Resources for iOS devs
Windows 8 controls for iOS devs
Windows 8 cookbook for iOS devs
Lifecycle topics
Application lifecycle (Windows Store apps)
Application class
How to activate an app (Windows Store apps using C#/VB/C++ and XAML)
Launching, resuming, and multitasking (Windows Store apps using C#/VB/C++ and XAML)
Quickstart: Determining device orientation with the SimpleOrientation sensor (C#)

 

 

Show:
© 2017 Microsoft