Getting error 'AVCapturePhotoOutput' is unavailable

I'm writing a small program to take as photo on macOS using the iSight camera. I'm trying to follow along Apple's development documentation, but I'm getting stuck on the very first step: I can't declare the variable AVCapturePhotoOutput.

I've searched the error on Google, StackOverflow, and Apple's documentations and haven't found anything helpful.

import Cocoa
import AVFoundation

class ViewController: NSViewController, AVCapturePhotoCaptureDelegate {

    var captureSesssion : AVCaptureSession!
    var cameraOutput : AVCapturePhotoOutput!

I get errors saying,

'AVCapturePhotoCaptureDelegate' is unavailable
1. 'AVCapturePhotoOutput' has been explicitly marked unavailable here (AVFoundation.AVCapturePhotoOutput)

In my Build Settings, it says I'm using Swift 4.2 with Xcode version 10.1. On the Apple website, it says AVCapturePhotoOutput is for macOS 10.15 (beta). I just updated my os to this version, but I'm still getting these errors.

1 answer

  • answered 2019-08-18 08:27 Romain

    I think you need to use Xcode 11 with Swift 5.1 and target macOS 10.15.