iOS 10 Privacy Settings
Since the iOS upgrade apps need to register their use of various phone features, which if you are developing an old app can cause unexpected results.
Our TheatreSound app suddenly started to create two strange results:
- The Media Picker wouldn't work. It would just open as a blank screen and then immediately close again. No warnings or notifcations were posted on the phone.
- When connected to Xcode, the same procedure produced:
2017-01-16 22:16:37.612964 TheatreSound[271:10452] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-01-16 22:16:37.620851 TheatreSound[271:10452] [MC] Reading from public effective user settings.
The media picker should have been fine. It was called via a simple IBAction
- (IBAction) showMediaPicker: (id) sender {
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];
picker.delegate = self;
picker.allowsPickingMultipleItems = YES;
picker.showsCloudItems = NO;
picker.prompt = NSLocalizedString (@"Choose loops", @"");
[self presentViewController:picker animated:YES completion:nil];
}
The first of these problems was harder to diagnose because no warnings were posted. But I had a feeling the problem might be to do with privacy settings, having had isses with connection to the microphone previously. Also, reviewing the Apple Media Player API reference, (the parent of the MPMediaPickerController), there is posted a notice saying:
The solution is to add the following into the app info.plist (Property List) file:
<key>NSAppleMusicUsageDescription</key>
<string>The library is used to source tracks, loops and sounds for your shows</string>
This information can also be added via Xcode, by clicking on the app name at the top of the file list tree to bring up the various project settings, selecting the main app target from TARGETS, and selecting the 'Info' tab. Expand 'Custom iOS Target Properties' and hover over the bottom line to bring up the + - buttons and click on the +. Then scroll down the list until you find the items starting with 'Privacy - '.
After that it all works as expected again.