Modifier

Partager via


CPApplicationDelegate.PerformFetch Method

Definition

Background support: Invoked by the operating system to allow an application to download data.

[Foundation.Export("application:performFetchWithCompletionHandler:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void PerformFetch (UIKit.UIApplication application, Action<UIKit.UIBackgroundFetchResult> completionHandler);
abstract member PerformFetch : UIKit.UIApplication * Action<UIKit.UIBackgroundFetchResult> -> unit
override this.PerformFetch : UIKit.UIApplication * Action<UIKit.UIBackgroundFetchResult> -> unit

Parameters

application
UIApplication

Handle to the UIApplication.

completionHandler
Action<UIBackgroundFetchResult>

Callback to invoke to notify the operating system of the result of the background fetch operation.

Attributes

Remarks

This method is part of iOS 7.0 new background fetch support. This method is invoked if your Entitlements list the "fetch" background operation and after you have enabled fetching by calling the SetMinimumBackgroundFetchInterval(Double) method.

Once that happens the operating system will determine the appropriate time to wake up your application to allow it to download data. When it does that, it will first call the FinishedLaunching(IUIApplicationDelegate, UIApplication, NSDictionary) method and then will invoke this method.

This method should download the data from the network and before it completes, it must invoke the provided callback with the appropriate status code to notify the operating system of the background fetch operation (new data was downloaded, there was a network connection problem or no new data was found).

Upon completion, you must notify the operating system of the result of the data transfer by invoking the provided callback.

Important: failure to call the provided callback method with the result code before this method completes will cause your application to be terminated.

Applies to