下面我看到了使用'captureStillImageAsynchronouslyFromConnection‘函数的问题:How to convert code AVFoundation objective c to Swift?
当我尝试使用AVFoundation函数时,如下所示:
var stillImageOutput: AVCaptureStillImageOutput!
//...Initialize stillImageOutput
stillImageOutput.captureStillImageAsynchronouslyFromConnection(videoConnection, completionHandler: {(imageSampleBuffer, error) in
if imageSampleBuffer {
var imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageSampleBuffer as CMSampleBuffer) // I get error on this line saying: 'Use of module ' CMSampleBuffer' as a type'
self.processImage(UIImage(data: imageData))
}
})我在XCode上得到了一个错误,上面写着‘使用模块’CMSampleBuffer‘作为一个类型’。我尝试用稍微不同的方式多次重写这一行,但我想不出解决方案。
我是做错了什么,还是可能是摇摇欲坠的XCode贝塔没有正常工作?
提前谢谢你。
发布于 2014-06-22 22:38:44
杰克和克里斯蒂安的解决方案对我有效。我没有小心到导入CoreMedia。我以前从未使用过这个框架,也不知道问题是否是因为没有导入正确的框架。谢谢你的帮助!
https://stackoverflow.com/questions/24356009
复制相似问题