This post serves as a guide for the order in which application delegate methods are invoked in response to certain actions on iOS. This information is current only for iOS 12.1 unless indicated otherwise.
Launch
application(_:willFinishLaunchingWithOptions:)
application(_:didFinishLaunchingWithOptions:)
applicationDidBecomeActive
Open
applicationWillEnterForeground
applicationDidBecomeActive
Launch from URL scheme
-
application(_:willFinishLaunchingWithOptions:)
Example Parameters:
{ UIApplicationLaunchOptionsSourceApplicationKey: "com.apple.mobilesafari", UIApplicationLaunchOptionsURLKey: "test://test.com" }
application(_:didFinishLaunchingWithOptions:)
- [if true is returned from 1. and 2.]
application(_:open:options:)
applicationDidBecomeActive
Open from URL scheme
applicationWillEnterForeground
application(_:open:options:)
applicationDidBecomeActive
Launch from universal link
-
application(_:willFinishLaunchingWithOptions:)
Example Parameters:
{ UIApplicationLaunchOptionsUserActivityDictionaryKey: { UIApplicationLaunchOptionsUserActivityIdentifierKey: "F42C288E-D721-4F5D-9AB5-4FEB1D634D99", UIApplicationLaunchOptionsUserActivityKey: "<NSUserActivity: 0x2827146a0>", UIApplicationLaunchOptionsUserActivityTypeKey: NSUserActivityTypeBrowsingWeb, }, UIApplicationLaunchOptionsSourceApplicationKey: "com.apple.mobilesafari" }
application(_:didFinishLaunchingWithOptions:)
- [if true is returned from 1. and 2.]
application(_:willContinueUserActivityWithType:)
- [if true is returned from 1. and 2.]
application(_:continue:restorationHandler:)
applicationDidBecomeActive
Open from universal link
applicationWillEnterForeground
application(_:willContinueUserActivityWithType:):
application(_:continue:restorationHandler:):
applicationDidBecomeActive
Launch from push
-
application(_:willFinishLaunchingWithOptions:)
Example Parameters:
{ UIApplicationLaunchOptionsRemoteNotificationKey: { aps = { alert = "Testing.. (0)"; badge = 1; sound = default; } } }
application(_:didFinishLaunchingWithOptions:)
userNotificationCenter(_:didReceive:withCompletionHandler:)
applicationDidBecomeActive
Open from push
applicationWillEnterForeground
userNotificationCenter(_:didReceive:withCompletionHandler:)
applicationDidBecomeActive
Launch from shortcut
-
application(_:willFinishLaunchingWithOptions:)
Example Parameters:
{ UIApplicationLaunchOptionsShortcutItemKey: <UIApplicationShortcutItem: 0x283ef6e00; type: com.recoursive.example.shortcutTest, title: Shortcut test> }
application(_:didFinishLaunchingWithOptions:)
- [if true is returned from 1. and 2.]
application(_:performActionFor:completionHandler:)
applicationDidBecomeActive
Open from shortcut
applicationWillEnterForeground
application(_:performActionFor:completionHandler:)
applicationDidBecomeActive