在appDelegate中未调用remoteControlReceivedWithEvent [英] remoteControlReceivedWithEvent not Called in appDelegate

查看:474
本文介绍了在appDelegate中未调用remoteControlReceivedWithEvent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用我的avplayer控制iPhone控件时遇到问题。

I'm having problem to control the iPhone controls with my avplayer.

如果我放置功能

- (void)remoteControlReceivedWithEvent:(UIEvent *)event

在负责播放被调用函数的视图控制器中,但仅当我要在当前视图控制器中进行后台操作时。

in the view controller that responsible for playing the function called but only if I i'm going to background in the current view controller.

如果我要去后台来自其他视图控制器的函数从未调用过。

if i'm going to background from other view controller the function never called.

这就是为什么我想把它放在app delegate中。

that's why i want to put it in the app delegate.

我尝试了Becomefirstresponse并将该功能放在每个视图控制器中但它确实有帮助。

I tried Becomefirstresponse and to put the function in every view controller but it did help.

我也打电话

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

-(void)applicationWillResignActive:(UIApplication *)application

thanks

推荐答案

您可以将响应程序链中的函数移动到UIApplication子类。通过这种方式,它始终可以捕获事件。

You can move the function up the responder chain, to UIApplication subclass. This way, it will always be there to catch the event.

这种事件在常见的UI和控制器类中被忽略,因此它会一直传到响应者的底部链,您的应用程序委托和应用程序本身所在的位置。

This kind of event is ignored in common UI and controller classes, so it travels up to the bottom of responder chain, where your app delegate and the the application itself reside.

如上所述这里,UIApplication的委托不是响应者链的一部分(我在这里错了)。 UIApplication就在那里,根UIWidow,链中的所有视图和相应的UIViewControllers也是如此。

As noted here, UIApplication's delegate is not part of responder chain (I was wrong here). UIApplication is there, so is root UIWidow, all the views in chain and corresponding UIViewControllers.

这篇关于在appDelegate中未调用remoteControlReceivedWithEvent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆