# record example can't record (iOS)

**URL:** <https://qa.fmod.com/t/record-example-cant-record-ios/13746>\
**Category:** FMOD Engine\
**Created:** [March 7, 2018, 10:11am UTC](https://qa.fmod.com/t/record-example-cant-record-ios/13746 "2018-03-07T10:11:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicczhang](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@vicczhang](https://qa.fmod.com/u/vicczhang)\
**Post date:** [March 7, 2018, 10:11am UTC](https://qa.fmod.com/t/record-example-cant-record-ios/13746/1 "2018-03-07T10:11:19Z")

</div>

Hello, when I use fmod record library run in iOS, it throw a error, and can’t continue to play in this code:

result = system-\>recordStart(DEVICE\_INDEX, sound, true);

it sounds like can’t record, my iOS version is iOS11, hope some one can help me to solve this problem, it is appreciate!

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [March 7, 2018, 9:17pm UTC](https://qa.fmod.com/t/record-example-cant-record-ios/13746/2 "2018-03-07T21:17:43Z")

</div>

Have you setup the AudioSession category correctly?

> **Recording** Much like lock screen and background audio, recording requires a particular AudioSession category to be active at the time of System::recordStart (and must remain active until the recording finishes). The required category is called 'play and record' and can be read about in the audio session basics documentation. Note that FMOD is always 'playing' audio (even silence) so it is not sufficient to simply use the 'recording' category unless you are running the 'No Sound' or 'Wav Writer' output mode.
> 
> Some devices may take some time to switch AudioSession category so it is recommended to set this category at application start time to avoid any hiccups in audio playback.

https://fmod.com/resources/documentation-api?page=content/generated/platform\_ios/basics.html#/

---

<div class="post-metadata">

**Author:** ![vicczhang](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@vicczhang](https://qa.fmod.com/u/vicczhang)\
**Post date:** [March 8, 2018, 2:02am UTC](https://qa.fmod.com/t/record-example-cant-record-ios/13746/3 "2018-03-08T02:02:01Z")

</div>

> [@](#):
>
> Have you setup the AudioSession category correctly?
> 
> > **Recording** Much like lock screen and background audio, recording requires a particular AudioSession category to be active at the time of System::recordStart (and must remain active until the recording finishes). The required category is called 'play and record' and can be read about in the audio session basics documentation. Note that FMOD is always 'playing' audio (even silence) so it is not sufficient to simply use the 'recording' category unless you are running the 'No Sound' or 'Wav Writer' output mode.
> > 
> > Some devices may take some time to switch AudioSession category so it is recommended to set this category at application start time to avoid any hiccups in audio playback.
> 
> https://fmod.com/resources/documentation-api?page=content/generated/platform\_ios/basics.html#/

that’s right！thank you very much！

---

<div class="post-metadata">

**Author:** ![vicczhang](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@vicczhang](https://qa.fmod.com/u/vicczhang)\
**Post date:** [March 8, 2018, 2:03am UTC](https://qa.fmod.com/t/record-example-cant-record-ios/13746/4 "2018-03-08T02:03:03Z")

</div>

add this code：  
[session setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
