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?
Asked
Active
Viewed 1,463 times
0
-
What do you mean by without user interaction? without click any button? – Vishal Feb 07 '13 at 11:20
-
Ok, without user interaction, but you have to define a function to call when a predefined condition is satisfied. take a look at this http://stackoverflow.com/questions/14253204/screen-capture-for-ios – Sergio Andreotti Feb 07 '13 at 11:25
-
Please find my answer here https://stackoverflow.com/a/62947941/2941150 – Kuldeep Bhimte Jul 17 '20 at 06:53
1 Answers
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
-
-
-
use this method - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info – iPatel Feb 07 '13 at 12:11