我正在學習,並且我自己目前無法弄清楚。AnyObject類型的值沒有成員生成器
我的代碼是:
func takeScreenshot(completionHandler handler: ((NSData!) -> Void)!)
{
// find out video connection
var videoConnection: AVCaptureConnection?
for conn in stillImageOutput!.connections {
for port in conn.inputPorts {
if port.mediaType == AVMediaTypeVideo {
videoConnection = conn as? AVCaptureConnection
break
}
}
if videoConnection != nil {
break
}
}
stillImageOutput!.captureStillImageAsynchronouslyFromConnection(videoConnection) { (sampleBuffer: CMSampleBuffer!, err: NSError!) in
let data = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(sampleBuffer)
handler(data)
}
}
在循環 「在conn.inputPorts端口」 我的錯誤。
感謝您的幫助!
類型'AnyObject'沒有成員什麼?通常有一些事情要結束該聲明,以澄清你試圖操縱的東西不存在 – Pierce
也許你的意思是做'connections.inputPorts'?...不知道,沒有足夠的信息。 –
AnyObject類型的值在'Generator'中沒有成員 –