I have a requirement whereby a photo needs to be taken from the camera without the user actually seeing it being taken.
Is it possible for an iOS application to take a photo without actually opening the photo app?
I have a requirement whereby a photo needs to be taken from the camera without the user actually seeing it being taken.
Is it possible for an iOS application to take a photo without actually opening the photo app?
From your brief description and constraints, of course it's possible.
My assumptions are:
Simply have your AVCaptureDevice requestAccessForMediaType:
for AVMediaTypeAudio
(required) and AVMediaTypeVideo
(required in some regions). You can then use that to take video recordings and photos (you only need the audio if you're doing A/V recordings). If you want to save the captures to Photos.app albums, the user will have to allow that as well. In all cases, the user will be presented with the choice to allow the app access to the camera (+mic) hardware or the photos album -- if any are denied, the app will not be able to capture recordings, nor save to Photos' albums, respectively.
You're going to (obviously) lose the ability to have the user touch the screen to focus on a point of interest, or other features that demand a user interface.
If you are just interested in capturing still photos, start your documentation reading at AVCaptureStillImageOutput
, specifically captureStillImageAsynchronouslyFromConnection:completionHandler:
.
Ignore the fear mongering in the comments above -- you will have to ask the user for permission regardless, there is no way to do this in a 100% hidden fashion.
Having said that, you also must comply with the App Store Review Guidelines, and I'm guessing specifically the sections on privacy, media content, and legal requirements.
And, most importantly:
We will reject Apps for any content or behavior that we believe is over the line. What line, you ask? Well, as a Supreme Court Justice once said, "I'll know it when I see it". And we think that you will also know it when you cross it.
In this case, I think that means: don't be a jerk.