Automatically launch FrontCamera and record the image

I want to make a camera application in which I want to automatically launch the front camera and capture an image without user interaction. thanks in advance.

+3
source share
3 answers

I don't know how much you know about objective-c or the development of iphone.
so I’ll show you how to take photos in your iphone application.
First of all, you should get your own view with the UIImagePickerController class

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

http://developer.apple.com/library/ios/samplecode/PhotoLocations/

http://developer.apple.com/library/ios/samplecode/PrintPhoto/

http://developer.apple.com/library/ios/samplecode/PhotoPicker/

http://developer.apple.com/library/ios/samplecode/iPhoneCoreDataRecipes/

, , .m

- (void)selectPhotos
{
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.delegate = self;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

- (void)imagePickerController:(UIImagePickerController *)picker
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
{
    imageView.image = image;
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

.

0

UIImagePickerController - . AVFoundation, , .

AVFoundation .

, , . 1317978. , UIGetScreenImage(). API, , .

, , .

+1

, ( presentModalViewController:), , ,

if([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]){
 self.imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera; //skipping this was crashing my app with some ** Assertion failure.
    picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
}

: 4,0, , cameraDevice iOS 4.0

+1

Source: https://habr.com/ru/post/1796447/


All Articles