iOS 8 Camera Privacy Settings

The AVFoundation framework introduced privacy controls for the microphone and camera in iOS 7. This was explained in WWDC 2013 Session #610 What’s New in Camera Capture. In brief you should not assume that the call to create an AVCaptureDeviceInput will succeed:

AVCaptureDevice *device = [AVCaptureDevice
  defaultDeviceWithMediaType:AVMediaTypeVideo];
AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput
  deviceInputWithDevice:device error:&error];
if (deviceInput) {
    // Access to the camera succeeded.
}

The first time an iOS 7 application requests access to the camera the user could be presented with a dialog asking for permission:

I stress the word could as I never once saw this behaviour in the UK. The previously mentioned WWDC session does give a hint why:

In some regions, law requires user consent to use the camera or mic

I never found a definitive statement as to which regions this was actually required behaviour so I was left wondering if I was missing something. That mystery has been solved this week when I finally got around to running the QR code capture sample project on an iOS 8 device and saw the dialog asking for permission.

This is confirmed by Apple in the WWDC 2014 Session #510 Camera Capture: Manual Controls. The camera privacy control is now required by iOS 8 for all regions. Previously it was difficult to test an iOS 7 app for the refusal case if you happen to live in a region where it is not required by law. Now with iOS 8 you can finally check that you handle the refusal gracefully.