所以我写了一种方法,应该用相机拍一张照片,然后将照片作为UIImage返回。但我已经得到了一个奇怪的错误Cannot convert the expression's type 'UIImage?'connectionWithMediaType(AVMediaTypeVideo),completionHandler:{(self.imageOutput!.connectionWithMediaType(AVMediaTypeVideo),completionHandler:{ (imageDataSampleB
我有一个AVCaptureSession,它在UIView中显示实时视频,我想将视频流的一个帧保存为一个UIImage。我一直在剖析我在互联网上看到的代码,但第一行我遇到了麻烦: // Establish an AVCaptureConnection and capture a still image from it.这给了我错误的'Camera‘没有一个名为’stillImageOutput‘的成员。代码依赖于能够从输出中获得视频连接。
如果有帮助的话,我可以贴出完整的代码块。谢谢
捕获的图像是我对capture()方法的返回值。
我想将捕获的照片保存到我的ViewController中的一个变量中,然后对另一个ViewController执行分段操作,它将显示该照片。这似乎不起作用,我得到一个fatal error: unexpectedly found nil while unwrapping an Optional value - Error。是nil,但是我如何在调用performSegue...函数之前将照片数据放入我的主线程中呢?saveToGallery save: Bool) -> UIImage