extra argument error in swift

Asked 2 years ago, Updated 2 years ago, 34 views

let videoInput=AVCaptureDeviceInput.deviceInputWithDevice(self.videoDevice, error:nil)!

Extra argument 'error' in call
with the above code What is the cause of the error?

swift

2022-09-30 19:05

1 Answers

Swift introduced do~try~catch as a new syntax for error handling from version 2.

The sled changed the NSError pointer as an argument to use try.

The reason for the error is that there is no last error argument already in this method, but you are trying to call it with an argument.

Therefore, the Extra argument, extra argument error appears.


2022-09-30 19:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.