Sound not working in iOS for iPad

2019-08-12 18:36发布

问题:

My game works fine in the simulator and on an actual iPod Touch device, but when I run it on my iPad 2 device the sound doesn't play and the sound effects don't play.

Here is my code to start up the background music. Keep in mind this works on the simulator AND on an actual iPod Touch device:

SoundEffect.MasterVolume = 1.0f;

SoundEffect soundMusic = (new ContentManager(screenManager.Game.Services, "Content")).Load<SoundEffect>("Music");
SoundEffectInstance soundMusicInstance = soundMusic.CreateInstance();

soundMusicInstance.IsLooped = true;
soundMusicInstance.Play();

Why doesn't this work on iPad?