UIKit.UIApplicationDelegate.WillFinishLaunching Method
Indicates that launching has begun, but state restoration has not yet occurred.

Syntax

[Foundation.Export("application:willFinishLaunchingWithOptions:")]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_6_0)]
public virtual bool WillFinishLaunching (UIApplication application, Foundation.NSDictionary launchOptions)

Parameters

application
Reference to the UIApplication that invoked this delegate method.
launchOptions
An NSDictionary with the launch options, can be null. Possible key values are UIApplication's LaunchOption static properties.

Returns

False if the application is unable to handle the specified url, true otherwise.

Remarks

This is the first method called when your UIApplication has been created, and by the time this is called, the storyboard or NIB files would have been loaded. When you return from this call, the state restoration protocol will take place, and after that, the UIApplicationDelegate.FinishedLaunching method will be invoked to complete the application startup.

The dictionary launchOptions if set, might contain zero or more information bits. You can use the following keys to retrieve information from it:

Dictionary Key for launchOptionsDescription
UIApplication.LaunchOptionsUrlKeyThe application was launched in response to open a URL. the value associated with the key contains the URL to open.
UIApplication.LaunchOptionsAnnotationKeyUse this key to find out if custom data was passed to the program by the opening application. The value of this key will be a property list.
UIApplication.LaunchOptionsLocalNotificationKey

The value of this key will be a UIKit.UILocalNotification instance.

This key will be present on the launch options if a local notification was delivered and the application was not running.

UIApplication.LaunchOptionsLocationKey

Application was started up in response to a location event.

The value of this key will be an NSNumber. The application should respond by creating a CoreLocation.CLLocationManager instance to and get the information from that object.

UIApplication.LaunchOptionsNewsstandDownloadsKey

This key indicates that Newsstand has completed downloading the requested data.

The value in the dictionary for this key, contains an array of strings that represent Newsstand.NKAssetDownload objects.

UIApplication.LaunchOptionsRemoteNotificationKeyThe value associated with this key will be an NSDictionary with the payload from the remote notification that was received.
UIApplication.LaunchOptionsSourceApplicationKeyThe value associated with the key is the bundle-id of the application that launched this application.
UIApplication.LaunchOptionsBluetoothPeripheralsKey

If this key is present, this means that the Bluetooth subsystem has launched the application to restore a previous operation that was being done by an CoreBluetooth.CBPeripheralManager objects.

The value of the key is an array of strings, each being the keys that you used when you created a CBPeripheralManager.

UIApplication.LaunchOptionsBluetoothCentralsKey

If this key is present, this means that the Bluetooth subsystem has launched the application to restore a previous operation that was being done by an CoreBluetooth.CBCentralManager objects.

The value of the key is an array of strings, each being the keys that you used when you created a CBPeripheralManager.

If the application is designed to handle urls, it should lookup the UIApplication.LaunchOptionsUrlKey key in the launchOptions to extract the url that is being launched, and return true at the end of the method to indicate that the application is able to load that url, or false if it is not.

C# Example

[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
    UIWindow window;

    public override bool WillFinishLaunching (UIApplication app, NSDictionary options)
    {
        if (options != null){
	    NSObject urlObject;
	    if (options.TryGetValue (UIApplication.LaunchOptionsUrlKey, out urlObject)){
	        var url = urlObject as NSUrl;

		// Examine the url here
		return CanHandle (url);
	    }
        }
    	return true;
    }
}

Requirements

Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0