captureOutput function isn't called using setSampleBufferDelegate

后端 未结 6 1959
臣服心动
臣服心动 2021-02-19 03:57

I\'m starting to develop an iOS app and this is my first SO post. I\'m trying to implement a UI view which can show the preview video of the rear camera and process the captured

6条回答
  •  迷失自我
    2021-02-19 04:41

    I had a similar issue, however my issue was due to the way I was creating the AVCaptureSession.

    I had opted to create the AVCaptureSession in a function and return it to the caller, this part is fine, however, I neglected to hold a reference to the session in a class variable which was causing the AVCaptureSession to go out of scope and be collected by ARC before the delegate could get invoked.

    Once I set the class variable so that the AVCaptureSession wasn't released when the calling function exited everything started to work.

    Wanted to share just in case someone else ran into the same issue.

提交回复
热议问题