Use Your Loaf

[[brain engage] write]

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.

Reset Location and Privacy Permissions

I have been doing some testing of the different ways that iOS 8 prompts the user for permission to privacy data. For example, when an application requests access to location data or to have access to the camera. The first time you install and run the app the user is prompted to grant the access:

Regardless of how the user responds they are never prompted again. If they want to change the preference they need to do it from the system settings:

It can sometimes be useful to reproduce that initial experience with the dialog prompt. Unfortunately the system setting persists across app deletion and reinstall. Deleting the app appears to remove the setting but as soon as you reinstall the privacy setting returns.

Reset Location & Privacy

The solution to get back to that initial state is to be found under General > Reset. Use the Reset Location & Privacy option and the next run will again prompt the user.

iOS 8 Adds Hebrew Speech Synthesis

A small change in iOS 8, but if you develop for Hebrew speaking users it may of interest. The AVFoundation classes for producing synthesized speech from text have added Hebrew as a supported language. This brings the total count of supported voices to 37. The sample project, SpeakEasy that I previously published for iOS 7 works on iOS 8 unmodified if you want to test the Hebrew support:

For reference, the updated list of available languages is shown below with both the display name (English locale) and the BCP-47 language code used when creating the voice.

Arabic (Saudi Arabia) - ar-SA
Chinese (China) - zh-CN
Chinese (Hong Kong SAR China) - zh-HK
Chinese (Taiwan) - zh-TW
Czech (Czech Republic) - cs-CZ
Danish (Denmark) - da-DK
Dutch (Belgium) - nl-BE
Dutch (Netherlands) - nl-NL
English (Australia) - en-AU
English (Ireland) - en-IE
English (South Africa) - en-ZA
English (United Kingdom) - en-GB
English (United States) - en-US
Finnish (Finland) - fi-FI
French (Canada) - fr-CA
French (France) - fr-FR
German (Germany) - de-DE
Greek (Greece) - el-GR
Hebrew (Israel) - he-IL
Hindi (India) - hi-IN
Hungarian (Hungary) - hu-HU
Indonesian (Indonesia) - id-ID
Italian (Italy) - it-IT
Japanese (Japan) - ja-JP
Korean (South Korea) - ko-KR
Norwegian (Norway) - no-NO
Polish (Poland) - pl-PL
Portuguese (Brazil) - pt-BR
Portuguese (Portugal) - pt-PT
Romanian (Romania) - ro-RO
Russian (Russia) - ru-RU
Slovak (Slovakia) - sk-SK
Spanish (Mexico) - es-MX
Spanish (Spain) - es-ES
Swedish (Sweden) - sv-SE
Thai (Thailand) - th-TH
Turkish (Turkey) - tr-TR