Tag: 捕获

如何捕捉图像,而不显示在iOS预览

我想要在特定的情况下捕捉图像,例如按下button时; 但我不想显示任何video预览屏幕。 我猜captureStillImageAsynchronouslyFromConnection是我需要用于这种情况。 目前,如果我展示video预览,我可以捕捉图像。 但是,如果我删除代码以显示预览,则应用程序会崩溃,并显示以下输出: 由于未捕获的exception'NSInvalidArgumentException',原因:'*** – [AVCaptureStillImageOutput captureStillImageAsynchronouslyFromConnection:completionHandler:] – 非活动/无效的连接通过终止应用程序。 “ ***第一掷调用堆栈:(0x336ee8bf 0x301e21e5 0x3697c35d 0x34187 0x33648435 0x310949eb 0x310949a7 0x31094985 0x310946f5 0x3109502d 0x3109350f 0x31092f01 0x310794ed 0x31078d2d 0x37db7df3 0x336c2553 0x336c24f5 0x336c1343 0x336444dd 0x336443a5 0x37db6fcd 0x310a7743 0x33887 0x3382c)终止叫做抛出exception(LLDB) 所以这里是我的实现: BIDViewController.h: #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface BIDViewController : UIViewController { AVCaptureStillImageOutput *stillImageOutput; } @property (strong, nonatomic) IBOutlet UIView […]