My project works fine on one MacBook, but after I transfering it to another MacBook, it crashes.
Here is a part of my code:
func MusicPlay()
{
Playnow = true
self.ipv.start()
self.playButton.isHidden = true
self.pauseButton.isHidden = false
var path = Bundle.main.path(forResource:music!,ofType :"mp3")
if Initial == true{
path = Bundle.main.path(forResource:music!,ofType :"mp3")
}
else{
switch music {
case "Viva La Vida":
path = Bundle.main.path(forResource:"result1",ofType :"mp3")
case "Something Just Like This":
path = Bundle.main.path(forResource:"result2",ofType :"mp3")
case "Señorita":
path = Bundle.main.path(forResource:"result3",ofType :"mp3")
default:
path = Bundle.main.path(forResource:music!,ofType :"mp3")
}
}
let soundUr1 = URL(fileURLWithPath: path!)
do{
try audioPlayer = AVAudioPlayer(contentsOf: soundUr1)
audioPlayer.volume = 1.0
audioPlayer.numberOfLoops = -1
audioPlayer.delegate = self
audioPlayer.play()
} catch{
print(error)
}
}
After choosing a music at tableView, it performs the function "MusicPlay",and then the project crashes at line 26:
try audioPlayer = AVAudioPlayer(contentsOf: soundUr1)
Error message:
2020-02-15 22:47:22.013016+0800 InteractivePlayerView[6645:253620] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000004d7120> F8BB1C28-BAE8-11D6-9C31-00039315CD46
What should I do to address this problem?
In my case I'm using a mac mini. They do not have a microphone.