0

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?

heymega
  • 9,215
  • 8
  • 42
  • 61
  • 3
    looks like a hack, I wouldn't expect iOS will let you do this. Do you have a good reason to do this? – Julian Aug 15 '14 at 19:21
  • I don't but my client does! I was hoping the camera/photo permission would be enough to allow this. – heymega Aug 15 '14 at 19:27
  • Possible duplicate http://stackoverflow.com/a/20934187/1230075 – franklinexpress Aug 15 '14 at 19:30
  • ah clients... would you like your system take pictures of you without letting you know? I don't think so. I'm almost sure it is impossible! – Julian Aug 15 '14 at 19:30
  • 1
    1. This will never get approved on the App Store. 2. Good luck trying to explain to a court why you're taking pictures from the phone's camera without the user's permission. 3. Probably deliberately made impossible by Apple's APIs to prevent such a "client" from surreptitiously monitoring its users. – esqew Aug 15 '14 at 19:38
  • 1
    @esqew I never said it would take a photo without the user's permission. The user would be made well aware of it. – heymega Aug 15 '14 at 19:47
  • @heymega, I don't understand why you have accepted a job, which you don't have idea how to do, or whether it is even possible to do...? – holex Aug 15 '14 at 20:19
  • Why are people speculating? This is a perfectly valid question yet I'm getting down voted for it lol @holex I never said I accepted a job and this has no bearing on the question. – heymega Aug 15 '14 at 20:40
  • @heymega, you said your _client_ wants that – therefore you have already _contracted_ with them, otherwise they'd not be your client, and you'd not try to find solution so desperately. on the other hand, you don't look a typical samaritan either. so, that was just simple logic. lol. :/ – holex Aug 15 '14 at 20:46
  • @holex They might be my client but it doesn't mean I have accepted any kind of job. I fail to see the relevance of your comments. Furthermore, I am not desperate for an answer, more curious as I don't have much experience in iOS development. I think I'll return to the .NET part of Stackoverflow, it's a lot nicer there! – heymega Aug 15 '14 at 20:58
  • @heymega, your assumption is correct about my comments – it is because my comment has no relevance to any suspicious questions, which are probably about pure data phishing – like yours. the community handled this question very well, even if that'd hurt you emotionally. you'll be very welcome here anytime, if you have a clear, reasonable and legal question! – holex Aug 15 '14 at 21:14

1 Answers1

5

From your brief description and constraints, of course it's possible.

My assumptions are:

  • That you want to do this from your own app, and not somehow launch Camera.app or Photos.app.
  • The app is running (I haven't tried this from the background).

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.

greymouser
  • 3,133
  • 19
  • 22
  • Thank you for taking the time to write a very detailed answer. I'll be sure to check out the points you've outlined. – heymega Aug 15 '14 at 21:01