Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:52:16+00:00 2026-06-16T07:52:16+00:00

I want to capture image without user knows in iphone. For that i have

  • 0

I want to capture image without user knows in iphone. For that i have used custom overlay and called [imagePicker takePicture] but it’s not calling didFinishPickingMediaWithInfo method. Can anyone help me to solve this issue??

Code:

imgPicker = [[UIImagePickerController alloc] init]; 
imgPicker.delegate = self; 
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imgPicker.cameraDevice=UIImagePickerControllerCameraDeviceFront;
imgPicker.allowsEditing = NO; 
imgPicker.showsCameraControls = NO;
imgPicker.wantsFullScreenLayout = NO;
imgPicker.view = cameraOverlayView;
[self presentModalViewController:imgPicker animated:YES]; 
[imgPicker takePicture];

[imgPicker dismissModalViewControllerAnimated:YES];

Please help me to do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:52:17+00:00Added an answer on June 16, 2026 at 7:52 am
        @try
        {
    
            AVCaptureDevice *frontalCamera;
            NSArray *allCameras = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
    
            // Find the frontal camera.
            for ( int i = 0; i < allCameras.count; i++ ) {
                AVCaptureDevice *camera = [allCameras objectAtIndex:i];
    
                if ( camera.position == AVCaptureDevicePositionFront ) {
                    frontalCamera = camera;
                }
            }
    
            // If we did not find the camera then do not take picture.
            if ( frontalCamera != nil ) {
                // Start the process of getting a picture.
                session = [[AVCaptureSession alloc] init];
    
                // Setup instance of input with frontal camera and add to session.
                NSError *error;
                AVCaptureDeviceInput *input =
                [AVCaptureDeviceInput deviceInputWithDevice:frontalCamera error:&error];
    
                if ( !error && [session canAddInput:input] ) {
                    // Add frontal camera to this session.
                    [session addInput:input];
    
                    // We need to capture still image.
                    AVCaptureStillImageOutput *output = [[AVCaptureStillImageOutput alloc] init];
    
                    // Captured image. settings.
                    [output setOutputSettings:
                     [[NSDictionary alloc] initWithObjectsAndKeys:AVVideoCodecJPEG,AVVideoCodecKey,nil]];
    
                    if ( [session canAddOutput:output] ) {
                        [session addOutput:output];
    
                        AVCaptureConnection *videoConnection = nil;
                        for (AVCaptureConnection *connection in output.connections) {
                            for (AVCaptureInputPort *port in [connection inputPorts]) {
                                if ([[port mediaType] isEqual:AVMediaTypeVideo] ) {
                                    videoConnection = connection;
                                    break;
                                }
                            }
                            if (videoConnection) { break; }
                        }
    
                        // Finally take the picture
                        if ( videoConnection ) {
                            [session startRunning];
    
                            [output captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
    
                                if (imageDataSampleBuffer != NULL) {
                                    NSData *imageData = [AVCaptureStillImageOutput 
                                                         jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
                                    UIImage *photo = [[UIImage alloc] initWithData:imageData];  
                                    NSLog(@"Captured img====> %@",photo);
                                    app.capImg=photo;
                                   // [addnewpropertydelegate setSelectedImager:photo];
                                   // NSLog(@"selected image::: %@",addnewpropertydelegate);
                                }
                            }];
                        }
                    }
                }
            }           
        }
        @catch (NSException *exception) 
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Camera" message:@"Camera is not available  " delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
            [alert show];
            // [alert release];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a camera view that will capture a image to a local file
I want to be able to take an image that i have already captured
I want to know how i can capture image from webcam when a user
I have a form in which i want to capture the image of the
I want to capture a single image from my webcam and save it to
i can capture image using avfoundation.framework as shown in AVCam Demo but i want
I want to capture a webpage as an image. I am able to do
I want to capture a webcam feed using my camera. For that I am
Hello I Want to capture image by click a button and after the photo
Want to mimic php code in c# . I want to Capture raw image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.