我正试图摆脱 AVCaptureStillImageOutput 并采用 iOS 10 中引入的 AVCapturePhotoOutput。
但是,我的部署操作系统是 iOS 9.0。 AVCapturePhotoOutput 还能在 iOS 9 上运行吗?
最佳答案
这是不可能的,因为 AVCapturePhotoOutput 是在 iOS 10 SDK 中引入的,因此该类在早于此的 SDK 中不可用。如果您需要保持 iOS 9 的向后兼容性,您将不得不做一些额外的工作,直到您可以放弃支持。在 Swift 中,您可以使用内置的 #available 语法:
if #available(iOS 10, *) {
// use AVCapturePhotoOutput
}
else {
// use AVCaptureStillImageOutput
}
这使您可以根据给定应用安装所运行的 iOS 版本采取适当的行动。
关于iOS AVFoundation 的 AVCapturePhotoOutput,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40244825/
我想保存显示相机View的屏幕截图(AVCapturePhotoOutput)。我设置了cameraView(显示相机View)并添加了其他具有UIButton等部分的UIView。但是如果我保存它,保存到相机胶卷的图片只是一个白色View。(当我尝试保存self.view的屏幕截图时,它运行良好。)我该如何解决?classViewController:UIViewController,AVCapturePhotoCaptureDelegate{//forcameravarcaptureDevice:AVCaptureDevice!varcaptureSesssion:AVCaptur
我有一个应用程序设置,可以使用相机拍摄照片(基于计时器)来检测人脸的存在。当我向应用程序提供我已添加到Assets中的照片时,检测过程运行良好。然而,当我尝试直接使用相机的输出,甚至在将图像保存到文件后,生成的图像太暗以至于面部识别完全不可靠。如果我显示相机看到的图像,它看起来是正确的。我捕获了以下两张图像-一张来自实时看到的相机,另一张是从AVCapturePhotoOutput创建图像后的相同View。如果我只是在ImageView中显示捕获的图像,也会出现同样的黑暗。请注意评论:“我将断点放在这里并截取了屏幕截图”。然后我在代码完成时拍摄了第二个屏幕截图。这些是在高光下拍摄的。这
我正试图摆脱AVCaptureStillImageOutput并采用iOS10中引入的AVCapturePhotoOutput。但是,我的部署操作系统是iOS9.0。AVCapturePhotoOutput还能在iOS9上运行吗? 最佳答案 这是不可能的,因为AVCapturePhotoOutput是在iOS10SDK中引入的,因此该类在早于此的SDK中不可用。如果您需要保持iOS9的向后兼容性,您将不得不做一些额外的工作,直到您可以放弃支持。在Swift中,您可以使用内置的#available语法:if#available(iOS
我正在关注Apple的最新示例代码AVCamSwift,该代码已更新为使用AVCapturePhotoOutput。varisFlashScene:Bool{get}ABooleanvalueindicatingwhetherthescenecurrentlybeingpreviewedbythecamerawarrantsuseoftheflash.Thisproperty’svaluechangesdependingonthescenecurrentlyvisibletothecamera.Forexample,youmightusethispropertytohighlightt
很好奇,这在Swift4中会是什么?stimageout=AVCapturePhotoOutput()stimageout?.outputSettings=[AVVideoCodecKey:AVVideoCodecJPEG]目前,它的错误是Valueoftype'AVCapturePhotoOutput'hasnomember'outputSettings'这很奇怪,因为我不记得Apple改变过这个。这不是“求助”式的问题。我只是好奇Apple是否更改了此设置以及我需要执行的步骤来解决此问题。提前致谢。:) 最佳答案 问题是outp
以1080x1440分辨率显示预览;使用代码在iPhone8Plus上获取最大分辨率(3024x4032)和质量的照片:capturePhotoOutput?.capturePhoto(with:configurePhotoSettings(),delegate:self)照片设置:privatefuncconfigurePhotoSettings()->AVCapturePhotoSettings{letphotoSettings=AVCapturePhotoSettings()photoSettings.isHighResolutionPhotoEnabled=truephotoS
我只是想在我的ViewController中放置一个相机View。我在顶部导入了AVFoundation,还有UIImagePickerControllerDelegate和UINavigationControllerDelegate类。但是,每当我尝试使用AVCaptureStillImageOutput时,Xcode都会告诉我它在iOS10中已被弃用,我应该使用AVCapturePhotoOutput。这完全没问题,但是,只要我想调用stillImageOutput.outputSettings,.outputSettings本身就不可用。因此,我必须使用AVAVCaptureSt
我只是想在我的ViewController中放置一个相机View。我在顶部导入了AVFoundation,还有UIImagePickerControllerDelegate和UINavigationControllerDelegate类。但是,每当我尝试使用AVCaptureStillImageOutput时,Xcode都会告诉我它在iOS10中已被弃用,我应该使用AVCapturePhotoOutput。这完全没问题,但是,只要我想调用stillImageOutput.outputSettings,.outputSettings本身就不可用。因此,我必须使用AVAVCaptureSt
我一直致力于使用自定义相机,最近升级到Xcode8beta和Swift3。我最初有这个:varstillImageOutput:AVCaptureStillImageOutput?但是,我现在收到警告:'AVCaptureStillImageOutput'wasdeprecatediniOS10.0:UseAVCapturePhotoOutputinstead因为这是相当新的,所以我没有看到太多关于这方面的信息。这是我当前的代码:varcaptureSession:AVCaptureSession?varstillImageOutput:AVCaptureStillImageOutpu
我一直致力于使用自定义相机,最近升级到Xcode8beta和Swift3。我最初有这个:varstillImageOutput:AVCaptureStillImageOutput?但是,我现在收到警告:'AVCaptureStillImageOutput'wasdeprecatediniOS10.0:UseAVCapturePhotoOutputinstead因为这是相当新的,所以我没有看到太多关于这方面的信息。这是我当前的代码:varcaptureSession:AVCaptureSession?varstillImageOutput:AVCaptureStillImageOutpu