Ross Stepaniak
Ross Stepaniak

Reputation: 855

SCShareableContent.getExcludingDesktopWindows sometimes never calls the completionHandler

I have a rather simple piece of code:

    private var videoSampleQueue: DispatchQueue? = DispatchQueue(label: "queue.video")

    .....

    func startCapture(_ captureCompletion: StartCapturerCompletion?) {
        
        NSLog("Requesting shareable content")
          
        videoSampleQueue?.async {
            NSLog("Inside video queue")

            SCShareableContent.getExcludingDesktopWindows(true, onScreenWindowsOnly: false, completionHandler: { [weak self] content, error in
                NSLog("Shareable content received")
                self?.processContent(content, error, captureCompletion)
            })

    }
    
}

Sometimes (1 of 30 times approximately) the getExcludingDesktopWindows doesn't call the completion handler. It never prints the log 'Shareable content received'. It doesn't fire any error. I can't seem to notice any pattern and what may affect it. I use xCode 14.2, mac os 13.3.1. Any ideas apprecaited.

Upvotes: 4

Views: 345

Answers (0)

Related Questions