[英]How do I setup an MPErrorDomain listener
I'm trying to understand how to handle errors in obj-c on the MediaPlayer and we had someone do some work to do this for us on the AVPlayer but the way that is handled on AVPlayer is different, from what I can see in the documentation, than how errors are handled on the MPMusicPlayerController.我试图了解如何在 MediaPlayer 上处理 obj-c 中的错误,我们有人在 AVPlayer 上为我们做一些工作,但在 AVPlayer 上处理的方式与我在文档,而不是如何在 MPMusicPlayerController 上处理错误。
There is something called an MPErrorDomain which is a type of ErrorDomain.有一种叫做 MPErrorDomain 的东西,它是 ErrorDomain 的一种。
https://developer.apple.com/documentation/mediaplayer/mperrordomain?language=objc https://developer.apple.com/documentation/mediaplayer/mperrordomain?language=objc
Do I create an observer to listen for when this type of error object occurs?当发生这种类型的错误 object 时,我是否创建一个观察者来监听?
I am really just looking to understand how to process when one of these errors occur我真的只是想了解当这些错误之一发生时如何处理
https://developer.apple.com/documentation/mediaplayer/mperrorcode?language=objc https://developer.apple.com/documentation/mediaplayer/mperrorcode?language=objc
Ultimately I want to process these error codes https://developer.apple.com/documentation/mediaplayer/mperrorcode?language=objc最终我想处理这些错误代码https://developer.apple.com/documentation/mediaplayer/mperrorcode?language=objc
Do I create an observer to listen for when this type of error object occurs?
当发生这种类型的错误 object 时,我是否创建一个观察者来监听?
No. You just do stuff and either you get an error or you don't.不,你只是做一些事情,要么你得到一个错误,要么你没有。
Some methods have error parameters in their completion handlers:一些方法在其完成处理程序中有错误参数:
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/2582424-preparetoplay https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/2582424-preparetoplay
https://developer.apple.com/documentation/mediaplayer/mpmusicplayerapplicationcontroller/2815055-perform https://developer.apple.com/documentation/mediaplayer/mpmusicplayerapplicationcontroller/2815055-perform
Apart from that, you'll know you've got an error because the Console will say so (during debugging with Xcode).除此之外,你会知道你有一个错误,因为控制台会这样说(在使用 Xcode 进行调试期间)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.