简体   繁体   English

如何设置 MPErrorDomain 侦听器

[英]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.

相关问题 在这种情况下如何设置完成块? - How do I setup a completion block in this scenario? 当条件满足时,如何创建一个侦听器(我认为这就是所谓的)来触发事件? - How do I create a listener(I think thats what its called) to trigger an event when the conditions are meet? 如何设置对另一个变量/ UILabel变量的引用变量? - How do I setup a reference variable to another variable/UILabel variable? 如何使用当前设置将uitableview定制为不同的部分? - How do I customize a uitableview into different sections with my current setup? 我如何为gps实现一个监听器? - How can i implement a listener for the gps? 我应该如何设置此“抽屉”视图应用程序? - How should I setup this “drawer” view app? 当通过表格单元格附件在UINavigation设置中显示视图控制器时,如何知道它来自哪个表格单元格? - When showing a view controller in a UINavigation setup from a table cell accessory, how do I know which table cell it came from? 如何将鼠标悬停在IKImageBrowserCell的侦听器上? - How can I add a mouse over listener to a IKImageBrowserCell? 如何正确设置AFNetworking获取请求? - How I properly setup an AFNetworking Get Request? 在哪里设置自定义UITableViewCell的子视图? - Where do I setup a custom UITableViewCell's subviews?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM