Fix iOS Camera bug, Auto-Focus not working

My app's custom camera does not focus properly. Close distance images are sharp, but far distance objects show in low resolution. I contacted apple developer support for this and provided them with my source code. they pointed out what to look at. I attached two relevant files, and see below for response:

"Thanks for sending the two source files.

I took a look at these, and you appear to be using the same techniques for focus that are being used in the AVCam & AVCamManual projects I referenced previously. More specifically, I'm referring to the following 'focusWithMode' method which you have also implemented in your code:

- (void)focusWithMode:(AVCaptureFocusMode)focusMode exposeWithMode:(AVCaptureExposureMode)exposureMode atDevicePoint:(CGPoint)point monitorSubjectAreaChange:(BOOL)monitorSubjectAreaChange

However, I'm not able to verify the value for the 'point' parameter you are passing into this function. This is something you'll want to check on -- for example, the AVCam sample simply uses a value of CGPointMake( 0.5, 0.5 ) here.

Also, when the AVCam sample code receives AVCaptureDeviceSubjectAreaDidChangeNotification notifications, it calls the same focusWithMode: method but specifies different values for the 'focusMode' (=Continuous) and 'monitorSubjectAreaChange' (=NO) parameters as shown here:

- (void)subjectAreaDidChange:(NSNotification *)notification


CGPoint devicePoint = CGPointMake( 0.5, 0.5 );

[self focusWithMode:AVCaptureFocusModeContinuousAutoFocus exposeWithMode:AVCaptureExposureModeContinuousAutoExposure atDevicePoint:devicePoint monitorSubjectAreaChange:NO];


You may also want to specify focusMode = Continuous and monitorSubjectAreaChange=NO in this case, otherwise with autofocus the device will autofocus once and then go to mode=locked (locked at current position), and with area change monitoring enabled you will receive subsequent AVCaptureDeviceSubjectAreaDidChangeNotification whenever it detects a change to the subject area (thus your function focusWithMode: will get called again). This may not be the desired behavior. Do you still have the problem if you use the above settings?

If you are indeed passing a valid 'point' value to the focusWithMode: function, and you are still able to reproduce the problem, then it may be a bug. In this case, you can certainly file a bug report using the Apple Bug Reporter ([url removed, login to view]) for our engineers to investigate.

And as discussed, let us know if you are able to reproduce the problem using the AVCam & AVCamManual projects. These projects demonstrate best practices for working with the AVFoundation Capture APIs. If you can't reproduce the problem using these projects, then you should compare your code against these to make sure you are using the same recommended techniques for the Capture APIs.

Scott Kuechle

Apple Developer Technical Support"

Skills: iOS Development, iPhone, Mobile App Development, Objective C, Swift

See more: iphone 6 camera won't focus up close, iphone 6 camera not focusing, iphone 7 camera won't focus, iphone 6 plus camera won't focus far away, iphone 7 blurry camera, iphone 7 camera not focusing, iphone 7 camera focus issue, iphone 7 camera focus problem, fix my app 6, Android/iOS native fix-critical small bug, fix my app, iOS application bug fix, bug fix ios, need to fix some errors in my taxi app, fix some minor bugs with my app

About the Employer:
( 13 reviews ) Wilmington, United States

Project ID: #14951396

21 freelancers are bidding on average $65 for this job

$55 USD in 1 day
(134 Reviews)

Hi, I'm interested in your project. Please send me a message so that we can discuss more. Relevant Skills and Experience I have a 7+ years of experience in Android and iPhone apps development.I understood your require More

$50 USD in 1 day
(48 Reviews)
$100 USD in 1 day
(26 Reviews)

Dear sir. I have checked your job requirement carefully. I will show you the app link that I have developed . [login to view URL] http More

$35 USD in 40 days
(27 Reviews)
$55 USD in 40 days
(37 Reviews)

Greetings from Netra Technosys! My self DharmeshKumar. With a hands-on 5+ years experience in delivering various Mobile apps. We've developed 26+ Apps. In which almost all are live in AppStore. Relevant Skills and Exp More

$10 USD in 40 days
(9 Reviews)

Hello, We are specialized in Mobile(IOS & ANDROID) Apps & Game(2D-3D) Development/Web Technologies/VR/AR/Web API/CMS/ADMIN PANELS Development & having 7 years of experience as an IT [login to view URL] quote and time i More

$55 USD in 1 day
(26 Reviews)

-- 100% Job Success Score -- -- Professional Mobile App Developer -- iOS application using Xcode, Objective-C, Swift is my main programming part. Relevant Skills and Experience I have full experiences in making back More

$40 USD in 1 day
(11 Reviews)

Hi, I am a iOS developer with 3+ years experience and i have used the auto layout for design, use the latest Swift language version for development and also fully knowledge of Objective C. I have most experienc More

$55 USD in 1 day
(5 Reviews)

thanks for sharing the apple response and the related file. from the response they just suggested few things to do. from the related file the code base is huge. Relevant Skills and Experience Will need access to app c More

$166 USD in 10 days
(3 Reviews)

Hi Thanks for sharing your requirement. We are a team of 50+ highly qualified and talented digital experts in creative web design, technical web developers and experienced project managers. We are having more than More

$35 USD in 1 day
(5 Reviews)

++ This is my job. I'm ready to begin now. Pm for me. Thanks Looking forward to hear from you, Feel free to talk about this interesting stuff, give us any questions you have to know more about us ;-) Relevant Skills More

$35 USD in 40 days
(1 Review)

Hello, I am swati, I have 6 year of experience in IOS Development(Objective C ,Swift 3 ,Xcode ). I completed many projects of IPhone Recently project which i completed in IOS Sawraj Digital.I used firebase push notific More

$60 USD in 2 days
(2 Reviews)

Hi, Recently I have worked over camera app and resolved the issues of app.I hope you will go through that app. [login to view URL] Relevant Skills and More

$277 USD in 40 days
(1 Review)
$72 USD in 40 days
(0 Reviews)

i am pretty experienced with android, ios, iphoen development message me so that we can discuss Relevant Skills and Experience Previous Task: [login to view URL] https://play. More

$50 USD in 40 days
(0 Reviews)

Hello, Greetings from Edigix!!! Edigix provides IT Sales & Services for exploring out-sourcing opportunities. Let me give you a small brief about our company, we are India based mobile and web application deve More

$50 USD in 40 days
(0 Reviews)

I have done a similar type of work before as I have developed user-friendly, robust and scalable mobile applications for iOS, Android Relevant Skills and Experience I am an ios/android expert software programmer havin More

$35 USD in 40 days
(0 Reviews)
$35 USD in 40 days
(0 Reviews)
$66 USD in 3 days
(0 Reviews)