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 7860961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:30:26+00:00 2026-06-02T22:30:26+00:00

I am trying to make auto focus work in my app, tested in iPad2.

  • 0

I am trying to make auto focus work in my app, tested in iPad2. My problem is that when I called check methods like isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus, it always return NO. However, I could tap to focus with other camera applications in my device

devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *tempDevice in devices) {
    [tempDevice lockForConfiguration:nil];
    if ([tempDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
        NSLog(@"Here");
    }

    if ([tempDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
        NSLog(@"Here");
    }

    if ([tempDevice isFocusModeSupported:AVCaptureFocusModeLocked]) {
        NSLog(@"Here");
    }

    if ([tempDevice isFocusPointOfInterestSupported]) {
        NSLog(@"Here");
    }
    [tempDevice unlockForConfiguration];
}
  • 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-02T22:30:28+00:00Added an answer on June 2, 2026 at 10:30 pm

    I was just looking into this tonight. From what I have gleaned, the iPad 2 doesn’t do focus – it does exposure adjustment – so in the default Camera app, tapping the screen brings up a rect where the tap occurred indicating the area to do white point adjustment on.

    Perhaps I am wrong but this is what I have turned up, and seems to be confirmed by your API (isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus returning NO) tests.

    The cameras in the iPad 2 are pretty weak – especially the front-facing one. I am surprised Apple shipped with that.

    UPDATE: This is the code from the more recent AVCamDemo Apple sample that handles focus + exposure + white point. I don’t think this is in the AVCam example. AVCamDemo may onlly be available as a download of the WWDC code .dmg package from the developer center – not as a single download from the web.
    On my iPad 2 the exposure code never gets called.
    //-from AVCamDemo:

    - (BOOL) hasExposure
     {
    AVCaptureDevice *device = [[self videoInput] device];
    
    return  [device isExposureModeSupported:AVCaptureExposureModeLocked] ||
            [device isExposureModeSupported:AVCaptureExposureModeAutoExpose] ||
            [device isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure];
    }
    
    - (AVCaptureExposureMode) exposureMode
    {
    return [[[self videoInput] device] exposureMode];
    }
    
    - (void) setExposureMode:(AVCaptureExposureMode)exposureMode
    {
    if (exposureMode == 1) {
        exposureMode = 2;
    }
    AVCaptureDevice *device = [[self videoInput] device];
    if ([device isExposureModeSupported:exposureMode] && [device exposureMode] != exposureMode) {
        NSError *error;
        if ([device lockForConfiguration:&error]) {
            [device setExposureMode:exposureMode];
            [device unlockForConfiguration];
        } else {
            id delegate = [self delegate];
            if ([delegate respondsToSelector:@selector(acquiringDeviceLockFailedWithError:)]) {
                [delegate acquiringDeviceLockFailedWithError:error];
            }
        }
    }
    }
    
    - (BOOL) hasWhiteBalance
    {
    AVCaptureDevice *device = [[self videoInput] device];
    
    return  [device isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeLocked] ||
            [device isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeAutoWhiteBalance];
    }
    
    - (AVCaptureWhiteBalanceMode) whiteBalanceMode
    {
    return [[[self videoInput] device] whiteBalanceMode];
    }
    
    - (void) setWhiteBalanceMode:(AVCaptureWhiteBalanceMode)whiteBalanceMode
    {
    if (whiteBalanceMode == 1) {
        whiteBalanceMode = 2;
    }    
    AVCaptureDevice *device = [[self videoInput] device];
    if ([device isWhiteBalanceModeSupported:whiteBalanceMode] && [device whiteBalanceMode] != whiteBalanceMode) {
        NSError *error;
        if ([device lockForConfiguration:&error]) {
            [device setWhiteBalanceMode:whiteBalanceMode];
            [device unlockForConfiguration];
        } else {
            id delegate = [self delegate];
            if ([delegate respondsToSelector:@selector(acquiringDeviceLockFailedWithError:)]) {
                [delegate acquiringDeviceLockFailedWithError:error];
            }
        }
    }
    }
    
    - (BOOL) hasFocus
    {
    AVCaptureDevice *device = [[self videoInput] device];
    
    return  [device isFocusModeSupported:AVCaptureFocusModeLocked] ||
            [device isFocusModeSupported:AVCaptureFocusModeAutoFocus] ||
            [device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus];
    }
    
    - (AVCaptureFocusMode) focusMode
    {
    return [[[self videoInput] device] focusMode];
    }
    
    - (void) setFocusMode:(AVCaptureFocusMode)focusMode
    {
    
    
    AVCaptureDevice *device = [[self videoInput] device];
    if ([device isFocusModeSupported:focusMode] && [device focusMode] != focusMode) {
        NSError *error;
    
          printf(" setFocusMode    \n");
        if ([device lockForConfiguration:&error]) {
            [device setFocusMode:focusMode];
            [device unlockForConfiguration];
        } else {
            id delegate = [self delegate];
            if ([delegate respondsToSelector:@selector(acquiringDeviceLockFailedWithError:)]) {
                [delegate acquiringDeviceLockFailedWithError:error];
            }
        }    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make an iPhone app, but i found some issue that auto-rotate
So I am trying to make an auto updater to the game that I'm
I'm trying to make an auto-cliker for an windows app. It works well, but
I'm trying to make an app which asks users permissions and auto posts to
I am trying to make an app that can shutdown/reboot your phone at the
I am trying to find a way to make an auto-run script that when
I'm trying to make some auto suggest stuff for an app. But i'm having
I am trying to make height auto. Whatever i tried did not work until
I'm trying to make an auto login script and I'm stuck on the submit
Trying to make a custom :confirm message for a rails form that returns data

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.