ios-camera

How to force iOS camera to take a picture programmatically using AVFoundation?

Deadly 提交于 2019-11-28 11:12:47
问题 I need the iOS camera to take a picture without any input from the user. How would I go about doing this? This is my code so far: -(void)initCapture{ AVCaptureDeviceInput *newVideoInput = [[AVCaptureDeviceInput alloc] init]; AVCaptureStillImageOutput *newStillImageOutput = [[AVCaptureStillImageOutput alloc] init]; NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys: AVVideoCodecJPEG, AVVideoCodecKey, nil]; [newStillImageOutput setOutputSettings:outputSettings];

App crashes on enabling Camera Access from Settings iOS 8

a 夏天 提交于 2019-11-27 18:18:18
I am developing an app for iPhone, it is using camera for scanning barcodes and taking pictures. When we don't have Camera access and the user enables Camera Access, the app crashes and the re-opens. Can you folks help me to fix this? Thanks in advance. The first time you access the Camera the OS will automatically show the permission prompt. Whether the user allows or denies the prompt, your app will continue running. If the user at some point changes the Address Book, Calendars, Reminders, Camera, or Photos permissions, iOS will SIGKILL the app. It takes this action to ensure that the app no

How to turn the iPhone camera flash on/off?

≡放荡痞女 提交于 2019-11-27 03:18:18
How can I turn the iPhone's LED camera flash on/off programatically? #import <AVFoundation/AVFoundation.h> ... - (void) turnTorchOn: (bool) on { // check if flashlight available Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); if (captureDeviceClass != nil) { AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; if ([device hasTorch] && [device hasFlash]){ [device lockForConfiguration:nil]; if (on) { [device setTorchMode:AVCaptureTorchModeOn]; [device setFlashMode:AVCaptureFlashModeOn]; //torchIsOn = YES; //define as a variable/property if

App crashes on enabling Camera Access from Settings iOS 8

走远了吗. 提交于 2019-11-26 22:39:45
问题 I am developing an app for iPhone, it is using camera for scanning barcodes and taking pictures. When we don't have Camera access and the user enables Camera Access, the app crashes and the re-opens. Can you folks help me to fix this? Thanks in advance. 回答1: The first time you access the Camera the OS will automatically show the permission prompt. Whether the user allows or denies the prompt, your app will continue running. If the user at some point changes the Address Book, Calendars,

How to turn the iPhone camera flash on/off?

我怕爱的太早我们不能终老 提交于 2019-11-26 12:37:46
问题 How can I turn the iPhone\'s LED camera flash on/off programatically? 回答1: #import <AVFoundation/AVFoundation.h> ... - (void) turnTorchOn: (bool) on { // check if flashlight available Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); if (captureDeviceClass != nil) { AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; if ([device hasTorch] && [device hasFlash]){ [device lockForConfiguration:nil]; if (on) { [device setTorchMode