iOS, Mojave and video/audio playback - microphone permission

There’s an issue with iOS development of apps that play back video. When running an app in the simulator and that app plays media, the OS asks the user for “microphone” permission.
See here:

According to the linked discussion, this is fixed in Xcode 10.2 beta. However, according to the release notes for the beta, “You’re now only prompted once to authorize microphone access to all simulator devices. (45715977)”. This is good for development, but when running tests on Travis every time is the first time.

I checked this issue with Apple (via a Radar). This is what I wrote to them:

When running an app in the iOS simulator on macOS Mohave, user interaction (for microphone permission) is required when the app tries to play media. On Xcode 10.1 is was unbearable because the permission was required after every build.

Now in Xcode 10.2 (beta) it’s better because the permission is only required once (as the release notes say, “You’re now only prompted once to authorize microphone access to all simulator devices. (45715977)”).

However, even this once is a blocker when building and running on Travis and other providers that always start with a fresh image, because no user interaction is possible.

And this is their response (which is actually an action item for you):

This is behaving correctly. We expect whoever builds the CI image they’re using to install Xcode and trigger (then approve) this prompt before sealing the image.

Please make sure your Xcode (10.2+) images are configured correctly. Note that it cannot be fixed for 10.1 and below (on Mojave).

@noamtamim I’m just dropping a note here to let you know Xcode 10.2 GM [1] is available. We’ll follow up with an update on the issue you have raised.