Take photos without the camera app

I have a requirement according to which the photo must be taken from the camera if the user cannot see it.

Is it possible for an iOS app to take a photo without actually opening the photo app?


source to share

1 answer

From your brief description and limitations, of course it is possible.

My assumptions:

  • What do you want to do this from your own app and not launch Camera.app or Photos.app in some way.
  • The app works (I haven't tried this from the background).

Just try AVCaptureDevice requestAccessForMediaType:

for AVMediaTypeAudio

(required) and AVMediaTypeVideo

(required in some regions). Then you can use this to record videos and photos (you only need audio if you are doing A / V recordings). If you want to save pictures to Photos.app albums, the user will be allowed to do so as well. In all cases, the user will be given a choice allowing the application to access the camera device (+ microphone) or the photo album - if someone refuses, the application will not be able to record the recordings and not save to Photos' accordingly.

You are going to (obviously) lose the ability to connect the user to the screen to focus on a point of interest or other functionality that requires a user interface.

If you're just curious about taking still photos, start reading the documentation with AVCaptureStillImageOutput

, in particular captureStillImageAsynchronouslyFromConnection:completionHandler:


Ignore the fear in the comments above - you have to ask the user for permission no matter if there is a way to do it in a 100% hidden way.

Having said that, you must also comply with the App Store Review Rules , and I am assuming that specifically the privacy , media content and legal requirements sections .

And the most important thing:

We will reject Apps for any content or behavior that we believe is above the line. Which line, you ask? Well, as a Supreme Court Justice once said, "I'll know when I see it." And we think you will know that too when you cross it.

In this case, I think it means: don't be a jerk.



All Articles