iPhone "[AVAudioSession sharedInstance] setActive" There is no sound in Unity after turning it off and on

The currently used package will execute the following
[[AVAudioSession sharedInstance] setActive: NO error: nil];
[[AVAudioSession sharedInstance] setActive: YES error: nil];

But the audio of AudioSource is gone.
Go back to the iphone desktop and go to Unity.
Sound is restored.

How to restore the sound without returning to the desktop?

I myself face this problem for the past 2 days, and after a lot of search i finally found something to fix this.

By using [[AVAudioSession sharedInstance] setActive: NO error: nil], you’re stoping unity audio service from working.

But using [[AVAudioSession sharedInstance] setActive: YES error: nil] isn’t enough to make it work again.

You have yo actually “reset” the unity audio service to reinitialize everything.

And you can actually do that very easily by using AudioSettings.Reset inside C# code.

However, it reset also every AudioSource present in your scene.