我有一个带有 AVAudioPlayer 的简单示例程序,当我运行它时收到此消息。这发生在.play()称为:
2019-10-08 12:34:53.093726 + 1100 PlayNotes2 [1587:137643] [插件] AddInstanceForFactory:没有为 id <CFUUID 0x600000c580e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46 注册工厂
该程序运行良好,但我担心收到此消息。
这是我的完整代码。它在带有插座的视图上只有一个按钮playButtonTap。请注意,如果我使用注释掉的声明,也会发生同样的事情var audioPlayer。
import UIKit
import AVFoundation
class ViewController: UIViewController {
let soundFileName = "E_64kb"
// var audioPlayer = AVAudioPlayer()
var audioPlayer: AVAudioPlayer?
override func viewDidLoad() {
super.viewDidLoad()
let sound = Bundle.main.path(forResource: soundFileName, ofType: "mp3")
do {
audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: sound!))
} catch {
print(error)
}
}
@IBAction func playButtonTap(_ sender: Any) {
audioPlayer!.play()
}
}
Run Code Online (Sandbox Code Playgroud)