CPApplicationDelegate.PerformFetch 方法

定义

后台支持:由操作系统调用以允许应用程序下载数据。

[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

参数

application
UIApplication

UIApplication 的句柄。

completionHandler
Action<UIBackgroundFetchResult>

调用以通知操作系统后台提取操作结果的回调。

属性

注解

此方法是 iOS 7.0 新的后台提取支持的一部分。 如果权利列出“提取”后台操作,并在通过调用 方法启用提取后调用此方法,则会调用此方法 SetMinimumBackgroundFetchInterval(Double)

一旦发生这种情况,操作系统将确定唤醒应用程序的适当时间,以允许它下载数据。 执行此操作时,它将首先调用 方法, FinishedLaunching(IUIApplicationDelegate, UIApplication, NSDictionary) 然后调用此方法。

此方法应从网络下载数据,在完成之前,它必须使用相应的状态代码调用提供的回调,以通知操作系统 (下载新数据、出现网络连接问题或) 找不到新数据。

完成后,必须通过调用提供的回调来通知操作系统数据传输的结果。

重要说明:在此方法完成之前未能使用结果代码调用提供的回调方法将导致应用程序终止。

适用于