編輯

共用方式為


VNRequestCompletionHandler Delegate

Definition

A delegate that is called once for each feature detected in a VNRequest.

public delegate void VNRequestCompletionHandler(VNRequest request, NSError error);
type VNRequestCompletionHandler = delegate of VNRequest * NSError -> unit

Parameters

request
VNRequest

The VNRequest for which this is the delegate.

error
NSError

If not null, an error that occurred during vision processing.

Remarks

Developers will typically downcast the to the expected subtype and retrieve relevant data from the downcast value:

var findFacesRequest = new VNDetectFaceRectanglesRequest((request, error) =>
{
   if (error != null)
   {
	   HandleError(error);
   }
   else
   {
		var frs = request as VNDetectFaceRectanglesRequest;
		// Assert frs == findFacesRequest  
		var rs = frs.GetResults<VNFaceObservation>();
		foreach (var fo in rs)
		{ // ... etc ...

Applies to