You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let stillImageConnection: AVCaptureConnection? = connectionWithMediaType(mediaType: .video, connections: (stillImageOutput?.connections)! as [AnyObject])
open func connectionWithMediaType(mediaType: AVMediaType, connections: [AnyObject]) -> AVCaptureConnection? {
for connection: AnyObject in connections {
let connectionTmp: AVCaptureConnection = connection as! AVCaptureConnection
for port: Any in connectionTmp.inputPorts {
if (port as AnyObject).isKind(of: AVCaptureInput.Port.self) {
let portTmp: AVCaptureInput.Port = port as! AVCaptureInput.Port
if portTmp.mediaType == mediaType {
return connectionTmp
}
}
}
}
return nil
}
能不能用guard和可选绑定代替强制解包?
能不能不要这么多无意义的强制转型?
先把[AVCaptureConnection]强制转成[AnyObject] 再遍历 强制转回 AVCaptureConnection 这是什么操作????
这代码这么多强制操作真的大丈夫???
The text was updated successfully, but these errors were encountered: