Instance Method

initWithDevice:error:

Initializes an input to use a specified device.

Declaration

- (instancetype)initWithDevice:(AVCaptureDevice *)device error:(NSError * _Nullable *)outError;

Parameters

device

The device from which to capture input.

outError

If an error occurs during initialization, upon return contains an NSError object describing the problem.

Return Value

An input initialized to use device.

Discussion

In Swift, this API is imported as an initializer and is marked with the throws keyword to indicate that it throws an error in cases of failure.

You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in The Swift Programming Language (Swift 4.1) and About Imported Cocoa Error Parameters.

See Also

Creating an Input

+ deviceInputWithDevice:error:

Returns an input initialized to use a specified device.