You have to declare the error
variable that you are trying to use:
NSError *error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
And note that you need an &
before error
when you pass it to the method. And of course you should check it:
if (input) {
// it succeeded, do something
} else {
NSLog(@"Error trying to call deviceInputWithDevice: %@", error);
}