HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
标题几乎描述了一切,但在这里详细说明……
要在我的应用程序中播放视频我正在使用AVPlayerViewController,我以模态方式呈现 @H_404_8@

@H_404_8@

let player = AVPlayer.init(url: url)
let playerViewController = AVPlayerViewController.init()
playerViewController.player = player
parentViewController.present(playerViewController,animated: true,completion: {...})
@H_404_8@一切正常,视频全屏播放,我可以将设备旋转到横向和再次纵向移动……仍然一切都运行顺畅.

@H_404_8@当我点击右下角的语音气泡来改变音频或字幕设置时,这种UIAlertController以纵向模式显示(iPhone 7加肖像):

ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃

@H_404_8@在横向模式下点击相同的按钮时,它看起来像这样(基本相同,但将以纵向显示,iPhone 7横向):

ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃

@H_404_8@在iPad Air 2风景中做同样的事情看起来像这样

ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃

@H_404_8@现在实际问题是:在横向模式下在6 / 6s / 7 PLUS设备上播放电影并点击语音气泡时,应用程序崩溃了!这是调试器输出和堆栈跟踪中出现的内容

@H_404_8@2017-08-10 12:08:18.683184 0200 MyApp [27739:6396143] [Assert] transitionViewForCurrentTransition未设置! (< _UIFullscreenPresentationController:0x7ffe3e586000>)

ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃

@H_404_8@对我来说,它看起来像一个Apple bug,因为我在这里没有做任何特别的事情(至少我是这么认为),因为崩溃仅在使用plus设备时显示,这是唯一具有紧凑和常规尺寸类别的组合.

@H_404_8@有没有人知道这里发生了什么?

解决方法

我得到同样的问题,我在AppDelegate.m中使用以下代码修复它 @H_404_8@

@H_404_8@

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    for (UIView *transitionView in window.subviews) {
        if ([transitionView isKindOfClass:NSClassFromString(@"UITransitionView")]) {
            for (UIView *subView in transitionView.subviews) {
                id nextResponder = [subView nextResponder];
                if ([nextResponder isKindOfClass:NSClassFromString(@"AVFullScreenViewController")]) {
                    return UIInterfaceOrientationMaskAll;
                }
            }
        }
    }
    return   (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationLandscapeLeft);
}

大佬总结

以上是大佬教程为你收集整理的ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃全部内容,希望文章能够帮你解决ios – 在iPhone plus设备上点击横向媒体选择按钮时,AVPlayerViewController崩溃所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。