# Recording on iOS devices

**URL:** <https://qa.fmod.com/t/recording-on-ios-devices/19128>\
**Category:** Unity\
**Tags:** ios, unity\
**Created:** [August 14, 2022, 8:45pm UTC](https://qa.fmod.com/t/recording-on-ios-devices/19128 "2022-08-14T20:45:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danielkotzer](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@Danielkotzer](https://qa.fmod.com/u/Danielkotzer)\
**Post date:** [August 14, 2022, 8:45pm UTC](https://qa.fmod.com/t/recording-on-ios-devices/19128/1 "2022-08-14T20:45:12Z")

</div>

Hi,  
I have an app that is using the microphone, the app was created with unity 2020.3.37f1, and with Fmod 2.02.07

The app works fine on Windows, on Android, but on iOS, it is not recording.  
The only way I found to make it record, is by editing the iOS XCode project. In the iOS  
project I go to classes folder and open UnityAppController.mm. in the startUnity function, I edit this code:

```auto
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
    [audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
    if (UnityIsAudioManagerAvailableAndEnabled())
    {
        if (UnityShouldPrepareForIOSRecording())
        {
            [audioSession setCategory: AVAudioSessionCategoryPlayAndRecord error: nil];
        }
        else if (UnityShouldMuteOtherAudioSources())
        {
            [audioSession setCategory: AVAudioSessionCategorySoloAmbient error: nil];
        }
    }

    [audioSession setActive: YES error: nil];
    [audioSession addObserver: self forKeyPath: @"outputVolume" options: 0 context: nil];
    UnityUpdateMuteState([audioSession outputVolume] < 0.01f ? 1 : 0);

```

and turn it to this:

```auto
    AVAudioSession* audioSession = [AVAudioSession sharedInstance];
    [audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
    [audioSession setCategory: AVAudioSessionCategoryPlayAndRecord error: nil];
    [audioSession setActive: YES error: nil];
    [audioSession addObserver: self forKeyPath: @"outputVolume" options: 0 context: nil];
    UnityUpdateMuteState([audioSession outputVolume] < 0.01f ? 1 : 0);

```

Though I’m sure there must be a way to make the Unity project, do it automatically, I just don’t know how.

Can anyone help me with that?  
Thanks.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 15, 2022, 6:41am UTC](https://qa.fmod.com/t/recording-on-ios-devices/19128/2 "2022-08-15T06:41:42Z")

</div>

Unfrotunately we don’t currently have a way to make Unity do this automatically and manually editing UnityAppController.mm is the [recommened approach](https://fmod.com/docs/2.02/unity/platform-specifics.html#recording).

---

<div class="post-metadata">

**Author:** ![Danielkotzer](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@Danielkotzer](https://qa.fmod.com/u/Danielkotzer)\
**Post date:** [August 15, 2022, 7:26pm UTC](https://qa.fmod.com/t/recording-on-ios-devices/19128/3 "2022-08-15T19:26:13Z")

</div>

But then the Unity team is creating the UnityAppController.mm file, it makes sense that if you fill the “Microphone Usage Description” property in the player settings, you want to use the microphone, so they should be notified this fix is needed.
