对于 iPhone Xs MAX,我一次只能预览两个摄像头。这三个动作不能同时执行
guard self.camManager.setUpCamera(type: .builtInWideAngleCamera, position: .front, outputViewlayer: self.frontLayer!) else{
DispatchQueue.main.async {
let alertController = UIAlertController(title: "Error", message: "issue while setuping front camera", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK",style: .cancel, handler: nil))
self.present(alertController, animated: true, completion: nil)
}
return
}
guard self.camManager.setUpCamera(type: .builtInWideAngleCamera, position: .back, outputViewlayer: self.backLayer1!) else{
DispatchQueue.main.async {
let alertController = UIAlertController(title: "Error", message: "issue while setuping back camera", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK",style: .cancel, handler: nil))
self.present(alertController, animated: true, completion: nil)
}
return
}
guard self.camManager.setUpCamera(type: .builtInTelephotoCamera, position: .back, outputViewlayer: self.backLayer2!) else{
DispatchQueue.main.async {
let alertController = UIAlertController(title: "Error", message: "3rd camera", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK",style: .cancel, handler: nil))
self.present(alertController, animated: true, completion: nil)
}
return
}
这里,如果前两个工作正常,长焦相机将无法工作。