0

I am working on an mobile tracing app for the iPhone. I want to capture the picture of user without user interaction. I have searched on Google but found two links that don't meet my requirements. I found that we can do this by using AVCam and AVFoundation. Is there any sample code related to this? Do you have sample code?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179

1 Answers1

1

-takePicture should do the trick in deed. You have to provider a custom UI for the camera controls, because otherwise (for me) it doesn't work. Check out the developer documentation in Xcode and search for takePicture. The method description has everything you need.

Following provide simple logic for you:

- (IBAction) showCameraUI
{
    UIImagePickerController *picker;
    // create and display picker

   self.imagePicker = imagePicker;
   [NSTimer scheduledTimerWithTimeInterval:4.0
                             target:self
                           selector: @selector(targetMethod)
                           userInfo:nil
                            repeats:YES];
}

- (void)targetMethod
{
    [self.picker takePicture];
    // ...
}

Other option is

I Found That...

AVCaptureVideoDataOutputSampleBufferDelegate

to take pictures automatically.

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer   
   fromConnection:(AVCaptureConnection *)connection 

Checke official document and also this link with source of code.

It is pretty simple and thank you:)

iPatel
  • 46,010
  • 16
  • 115
  • 137