我已经尝试过了--在Watch App中使用声音文件ShipBullet.m4a和扩展名(以确保它可以被找到):
if let url = NSBundle.mainBundle().URLForResource("ShipBullet", withExtension:"m4a") {
let asset = WKAudioFileAsset(URL:url)
let sound = WKAudioFilePlayerItem(asset:asset)
audioPlayer = WKAudioFilePlayer(playerItem:sound)
}
audioPlayer.play()但是,audioPlayer始终为空,并且不会播放任何声音。为什么?谢谢你的帮助!
发布于 2015-06-13 21:42:53
请看我对同一问题的回复。Play sound on Watchkit
让我知道你是怎么做的,我似乎不能在手表上播放任何声音,但是在模拟器上它需要一个蓝牙耳机。
https://stackoverflow.com/questions/30772566
复制相似问题