Xcode游戏声音可以在SIM卡和iPad上播放,但不能在iPhone 6上播放

时间:2023-01-22 22:40:26

I created a simple spritekit game. It works and sounds great in the simulator and on my iPad2. The game runs fine on my daughters iPhone 6 but the background music and sound effects don't work. There are no errors. I checked the volume on the phone even playing some music in iTunes to make sure I could hear it.

我创建了一个简单的spritekit游戏。它在模拟器和我的iPad2上工作和听起来很棒。我的女儿iPhone 6上的游戏运行正常,但背景音乐和声音效果不起作用。没有错误。我检查了手机上的音量,甚至在iTunes中播放了一些音乐,以确保我能听到它。

Sound declarations: located just after the my custom class definition

声音声明:位于我的自定义类定义之后

let tickglass = SKAction.playSoundFileNamed("tickglass.wav", waitForCompletion: false)
let backgroundMusic = SKAudioNode(fileNamed: "peterpiperb.wav")

Locate in playGame function:

在playGame函数中找到:

backgroundMusic.autoplayLooped = true
addChild(backgroundMusic)

Sound effect when user touches the screen:

用户触摸屏幕时的声音效果:

runAction(tickglass)

All sounds are 44.1 kHz wav files store in a Sounds sub folder. I'm running Xcode 7.3, and iOS 9.3.5. and OS X 10.11.4

所有声音都是44.1 kHz wav文件存储在Sounds子文件夹中。我正在运行Xcode 7.3和iOS 9.3.5。和OS X 10.11.4

Keep in mind that I'm not new to programming but I am new to Xcode programming.

请记住,我不是编程新手,但我是Xcode编程的新手。

Thanks for your help!

谢谢你的帮助!

1 个解决方案

#1


1  

Well, one obvious idea is making sure your iPad has sound on. You would be surprised at the times stuff like that happens. Also make sure you has system sounds on in your systems. This post might have some additional help.

嗯,一个明显的想法是确保你的iPad有声音。你可能会对这种情况感到惊讶。还要确保系统中有系统声音。这篇文章可能会有一些额外的帮助。

#1


1  

Well, one obvious idea is making sure your iPad has sound on. You would be surprised at the times stuff like that happens. Also make sure you has system sounds on in your systems. This post might have some additional help.

嗯,一个明显的想法是确保你的iPad有声音。你可能会对这种情况感到惊讶。还要确保系统中有系统声音。这篇文章可能会有一些额外的帮助。