1

Everything is work fine, but why I get this error.

Xcode Debug Area

This is all my code.

import UIKit
import AVFoundation

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    var player: AVAudioPlayer!

    @IBAction func keyPressed(_ sender: UIButton) {
        playSound()
    }
    
    func playSound() {
        let url = Bundle.main.url(forResource: "C", withExtension: "wav")
        player = try! AVAudioPlayer(contentsOf: url!)
        player.play()
    }

}

The results are the same as I expect.

burnsi
  • 6,194
  • 13
  • 17
  • 27
binev.dev
  • 11
  • 2
  • Does this answer your question? [Swift 5.1 Error: \[plugin\] AddInstanceForFactory: No factory registered for id – burnsi Jan 20 '23 at 12:35
  • I already tried this, the error remains. – binev.dev Jan 20 '23 at 12:47
  • 1
    Have you read the second answer: `I believe the error message is a warning for simulators hence it is not important.`? Have you tested this on a real device? Does the warning persist? – burnsi Jan 20 '23 at 15:40
  • Thank you, @burnsi! I tried on a real device, there is no such error. – binev.dev Jan 20 '23 at 16:04

0 Answers0