ios - Use of undeclared identifier error when trying to perform method call -


I am using the AV Foundation framework, I try to call the method of "DeviceInputWithDevice" for an "AVCaptureDeviceInput" object I am doing

The problem is that the method calls "error" in the call that I have named "error" and I get this warning in the encode: using undelcared identifier 'error'

All of my Av Foundation Code view controller's ViewDidLoad method is located in the implementation here:

AVCaptureSession * session = [[AVCaptureSession alloc] init]; Session.sessionPreset = AVCaptureSessionPresetHigh; AVCaptureDevice * device = [AVCaptureDevice default DeviceWithMediaType: AVMediaTypeVideo]; AVCaptureDevice Input * Input = [AVCaptureDeviceInput DeviceInputWidth Device: Device Error: Error]; [Session addInput: input];

I did not know why the undisclosed identifier warns me for the "error" parameter.

Any help is greatly appreciated.

You have to declare a error variable that you try to use Are:

  NSError * error = zero; AVCaptureDevice Input * Input = [AVCaptureDeviceInput DeviceInputWidth Device: Device Error: & amp; Error];  

And note that when you pass it in the method, you get the & amp; error is required before and you should definitely check it out:

  if (input) {// it is successful, something Do} other {NSLog (@ "Error trying to call device inputwidth device:% @", error); }  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -