No factory registered for id***

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?

Post not yet marked as solved Up vote post of qizijia Down vote post of qizijia
16k views
  • In my case I'm using a mac mini. They do not have a microphone.

Add a Comment

Replies

It seems unlikely that the logged message has anything to do with the crash. What kind of crash is occurring? Can you show the backtrace (at least, the first 10 lines or so, if it's long) at the point of the crash?

What makes you conclude it crashes at line 26 (and not 30 for instance) ?


Do you have a plug in in a Mac that is missing on the other ?


Where do you call AddInstanceForFactory ?

Please show how you declare the property `audioPlayer`. If you declare it wrongly your app would crash at line 26.

(Though, I do not think the error message shown has anything to do with the crash.)


An example of wrong declaration:

var audioPlayer = AVAudioPlayer()


A right declaration:

var audioPlayer: AVAudioPlayer?

I user ffmpeg with this function "int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options);" get this follow


2020-04-11 19:01:24.211522+0800 FFmpeg[6430:460471] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000278e60> F8BB1C28-BAE8-11D6-9C31-00039315CD46

2020-04-11 19:01:24.284221+0800 FFmpeg[6430:460471] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000279980> 30010C1C-93BF-11D8-8B5B-000A95AF9C6A

I also encountered an issue with an unexpected:
No factory registered for id
error when trying to play sound. Xcode 12.2, Mac OSX Catalina 10.15.7, simulator running iOS 14.2.
Code had previously worked on prior versions of the simulator.
Problem ONLY happened when I had Mac System Preferences > Sound > Output set to my Logitech USB Headset. The code otherwise worked when: played through my LG Monitor, played through my Airpods Pro, and when executing on my iPhone 11 Pro.

Spent over an hour trying to diagnose the issue before restarting & noticing audio working when headset wasn't used for output.
Not even sure where to file this issue, but hoping it helps someone. Am assuming it's an OS-specific issue & not one that'll result in a problem w/the app or code.
@gallaugher
Same problem with Xcode 12.2 (did show occur on Xcode 11). May be since I selected Swift5 format ?
[plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000025e240> F8BB1C28-BAE8-11D6-9C31-00039315CD46
@OOPer, your solution doesn't work for me.

This is now showing up on my console, but not causing a crash. The audio (mp3 file) still plays as expected. I use AVAudioPlayer from AVFoundation in my code on macOS Big Sur, XCode 12.3, Swift 5.3. I building a macOS app, not iOS.

I declare my player as var player:AVAudioPlayer? (I had it also as AVAudioPlayer!) and both produce the same console message above. Like I wrote above, the audio still plays, but I would like to get this resolved so the message no longer appears.

I stepped through my code and the error is appearing immediately upon calling player?.prepareToPlay() method.

EDIT: Subsequent calls to this method does not reproduce the error in the console. It is only happening upon the initial call to this method. If I play a subsequent mp3 file it doesn't repappear.

Code Block
if player?.prepareToPlay() != nil {

Thanks to anyone who can suggest how to resolve this.
I am also experiencing the same.
[plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000028c4b60> F8BB1C28-BAE8-11D6-9C31-00039315CD46
It works normally without any break-points. The minute I add a breakpoint it crashes with this error
 [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000028c4b60> F8BB1C28-BAE8-11D6-9C31-00039315CD46
My code is very simple where it tries to play a wav file.

I had the same problem and I solved it by put "var audioPlayer: AVAudioPlayer?" in the class itself not inside any method. When I had that error, I put the declaration in the viewDidLoad so the audio did not play and I got that error.

  • @Shm_m putting the variable in your view did load method probably caused it not to play because the audioPlayer was deallocated immediately, it probably had nothing to do with the error/warning.

Add a Comment