如何解决 \xe2\x80\x9cAddInstanceForFactory: 没有为 id <CFUUID 0x600001bef9c0>\xe2\x80\x9d 注册工厂错误?
\nstruct PlayerContentView: View {\nvar data:datamodel\n@State var player = AVQueuePlayer(playerItem: AVPlayerItem(url: Bundle.main.url(forResource: "1", withExtension: "mp4")!))\n@State var playerlooper = AVPlayerLooper(player: AVQueuePlayer(playerItem: AVPlayerItem(url: Bundle.main.url(forResource: "1", withExtension: "mp4")!)), templateItem: AVPlayerItem(url: Bundle.main.url(forResource: "1", withExtension: "mp4")!))\n\nvar body: some View {\n VStack{\n HStack{\n backButton\n Spacer()\n }.padding()\n .padding(.top)\n PlayerView2(player: $player).cornerRadius(15)\n .frame(width: UIScreen.main.bounds.width - 10, height: UIScreen.main.bounds.height / 1.9, alignment: .center)\n\n }\n .onAppear {\n \n player = AVQueuePlayer(playerItem: AVPlayerItem(url: Bundle.main.url(forResource: data.exercise[excount].video, withExtension: "mp4")!))\n playerlooper = AVPlayerLooper(player: player, templateItem: AVPlayerItem(url: Bundle.main.url(forResource: data.exercise[excount].video, withExtension: "mp4")!))\n player.pause()\n }\n \nRun Code Online (Sandbox Code Playgroud)\n
这只是一条信息性消息,而不是错误。几个版本前,AVFoundation 开始显示\xe2\x80\x9cAddInstanceForFactory: Nofactory Registered for id \xe2\x80\x9d。仅当使用 AVFoundation 的应用程序在模拟器上运行时才会出现此消息,大概是因为模拟器不是在工厂制造的。该消息不会出现在实际设备上。
\n根据我的经验,该消息并不表示有任何问题。如果您的应用程序出现问题,请查找该问题的其他迹象。
\n