# Fmod core api encounters crash problem on iOS

**URL:** <https://qa.fmod.com/t/fmod-core-api-encounters-crash-problem-on-ios/22012>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [August 18, 2024, 2:19am UTC](https://qa.fmod.com/t/fmod-core-api-encounters-crash-problem-on-ios/22012 "2024-08-18T02:19:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lxy1114](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lxy1114](https://qa.fmod.com/u/lxy1114)\
**Post date:** [August 18, 2024, 2:19am UTC](https://qa.fmod.com/t/fmod-core-api-encounters-crash-problem-on-ios/22012/1 "2024-08-18T02:19:12Z")

</div>

I would like to ask if Sound will be released automatically after playing. I set up a callback after playing to play another sound under certain circumstances. In the callback function, I released the previous Sound, but it will crash on iOS. In other cases, it will crash. It doesn’t seem to be possible on the platform.  
The code snippet is as follows

```auto
channel->setCallback([](FMOD_CHANNELCONTROL *channelcontrol,FMOD_CHANNELCONTROL_TYPE controltype,FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype,void *commanddata1,void *commanddata2) -> FMOD_RESULT {
				if(FMOD_CHANNELCONTROL_CALLBACK_END==callbacktype)
				{
					FMOD::Channel *cc = (FMOD::Channel*)channelcontrol;
										// The following release will crash on ios
					FMOD::Sound *s = nullptr;
					if(FMOD_OK==ERRCHECK(cc->getCurrentSound(&s)) && s)
					{
						s->release();
					}
				}
				return FMOD_OK;
			});

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 19, 2024, 3:20am UTC](https://qa.fmod.com/t/fmod-core-api-encounters-crash-problem-on-ios/22012/2 "2024-08-19T03:20:00Z")

</div>

Hi,

What version of the FMOD engine are you using?

> [@lxy1114](#):
>
> Sound will be released automatically after playing

No, release will need to be called to free the sound object.

Would it be possible to get the full script? I would like to see how the sound is being played. If you check the result returned from `s->release();` what is returned? Additional information about `Sound::release` can be found here: [FMOD Engine | Core API Reference - Sound::release](https://fmod.com/docs/2.02/api/core-api-sound.html#sound_release).

---

<div class="post-metadata">

**Author:** ![lxy1114](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lxy1114](https://qa.fmod.com/u/lxy1114)\
**Post date:** [August 22, 2024, 1:40am UTC](https://qa.fmod.com/t/fmod-core-api-encounters-crash-problem-on-ios/22012/3 "2024-08-22T01:40:47Z")

</div>

I’m using this version: fmodstudioapi20207ios-installer.dmg, Do I need to upgrade to the latest version? The latest version does not have this Problem?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 22, 2024, 3:19am UTC](https://qa.fmod.com/t/fmod-core-api-encounters-crash-problem-on-ios/22012/4 "2024-08-22T03:19:31Z")

</div>

Thank you for the information, updating to the latest may solve the issue.

> [@lxy1114](#):
>
> The latest version does not have this Problem?

Unfortunately, I am not sure as I am unable to reproduce the issue. Would it be possible to see the full script as well?
