swift - How do I fix the error "deviceInputWithDevice is unavailable"? -


i'm "upgrading" app swift swift 2 , came across follow error: 'deviceinputwithdevice' unavailable: use object construction 'avcapturedeviceinput(device:error:)'

here code in question:

    let capturedevice = avcapturedevice.defaultdevicewithmediatype(avmediatypevideo)     var input:avcapturedeviceinput     let error:nserror?      {         let input = try avcapturedeviceinput.deviceinputwithdevice(capturedevice) avcapturedeviceinput     } catch let error nserror {         print(error)     } 

can me understand suggested solution: "use object construction 'avcapturedeviceinput(device:error:)'" , how can implement please?

    {         let input = try avcapturedeviceinput(device: capturedevice) avcapturedeviceinput         // moved rest of image capture do{} scope. 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -