Tag: 扮演游戏

无法接收remoteControlReceivedWithEvent – 目标c – ios

屏幕locking后,我成功启用了我的应用程序,以便能够在后台播放audio和video。 但是,为了更好的用户体验,我想在locking的屏幕上显示播放和暂停正在运行的媒体的控件。 在线跟随几个博客之后,添加了以下代码: @interface MyControllerClass () <UIGestureRecognizerDelegate, UIApplicationDelegate> – (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:url options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:avAsset]; AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory:AVAudioSessionCategoryPlayback error:nil]; NSError *activationError = nil; BOOL success = [[AVAudioSession sharedInstance] setActive: YES error: &activationError]; } – (void)viewWillDisappear:(BOOL)animated { [[UIApplication […]