AVPlayer在全屏模式下崩溃

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AVPlayer在全屏模式下崩溃相关的知识,希望对你有一定的参考价值。

ios 13.3.1]上,AVPlayer全屏崩溃。旋转屏幕后,Xcode控制台将显示错误Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger

我添加了一个符号断点,调试器捕获了以下错误

UIWindow:0x108b99360
|   UITransitionView:0x108c53a10
|   |   UIView:0x11be462b0
|   |   |   UIView:0x11beab9d0
|   |   |   UIView:0x11a7c9890
|   |   |   UIView:0x11bebacc0
|   |   |   UIView:0x11be10d00
|   |   UIDropShadowView:0x113c14b00
|   |   |   UILayoutContainerView:0x108bf0790
|   |   |   |   UITransitionView:0x108bc1410
|   |   |   |   |   UIViewControllerWrapperView:0x108ba1590
|   |   |   |   |   |   •UILayoutContainerView:0x108ba25c0
|   |   |   |   |   |   |   +UINavigationTransitionView:0x108bc04b0
|   |   |   |   |   |   |   |   +UIViewControllerWrapperView:0x11ae32650
|   |   |   |   |   |   |   |   |   •UIView:0x11a7c90f0
|   |   |   |   |   |   |   |   |   |   *<UILayoutGuide: 0x280700b60 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 20}, {667, 425}}, owningView = <UIView: 0x11a7c90f0; frame = (0 0; 667 375); autoresize = W+H; animations = { position=<CABasicAnimation: 0x283e654e0>; bounds.origin=<CABasicAnimation: 0x283e65420>; bounds.size=<CABasicAnimation: 0x283e65460>; position-2=<CABasicAnimation: 0x283e60a20>; bounds.origin-2=<CABasicAnimation: 0x283e60980>; bounds.size-2=<CABasicAnimation: 0x283e60920>; }; layer = <CALayer: 0x283ebb900>>>- AMBIGUOUS LAYOUT for UILayoutGuide:0x280700b60'UIViewSafeAreaLayoutGuide'.Height{id: 8167}
|   |   |   |   |   |   |   |   |   |   *UIView:0x11a7c8e10
|   |   |   |   |   |   |   |   |   |   |   •UIView:0x11ae5b960
|   |   |   |   |   |   |   |   |   |   |   |   *<UILayoutGuide: 0x28071fc60 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 0}, {375, 375}}, owningView = <UIView: 0x11ae5b960; frame = (0 0; 375 375); autoresize = W+H; gestureRecognizers = <NSArray: 0x2830ff750>; layer = <CALayer: 0x283f1b6a0>>>
|   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x11ae598b0
|   |   |   |   |   |   |   |   |   |   |   |   *UIImageView:0x108ba76e0
|   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x11aea33b0
|   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x108cf2320
|   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x11aea3660'Tap to reload'
|   |   |   |   |   |   |   |   |   |   |   |   *NTV.GradientView:0x11ae77740
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x108ba8140
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x108b93db0'Now Playing- Swasthya Sar...'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x108ba64a0'2020-02-14 09:30 - 10:00'
|   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x114c062e0'11:59:23'
|   |   |   |   |   |   |   |   |   |   |   |   |   *UISlider:0x108ba8870 alignmentRect = (16 300.5; 343 18.5) for frame = (14 300.5; 347 19.5);
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIProgressView:0x108c3b7c0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x108c142a0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x108c06090
|   |   |   |   |   |   |   |   |   |   |   |   |   |   UIView:0x11bea2880
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x11bea2b60
|   |   |   |   |   |   |   |   |   |   |   |   |   |   UIView:0x11bea29f0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x11bea4b20
|   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x11bea4cf0
|   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x11ae01e00'00:00'
|   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x108ba3e70'
答案

对我来说,发生这种情况是因为layoutSubviews下存在无限循环。一旦我解决它就解决了。以为该崩溃仅出现在iOS 13上,而以前的iOS版本没有问题。

以上是关于AVPlayer在全屏模式下崩溃的主要内容,如果未能解决你的问题,请参考以下文章

在全屏模式下添加 MPMoviePlayerController?

在全屏模式下收听状态栏/导航栏可见性?

在全屏模式下隐藏标题?

MPMoviePlayerController 在全屏模式下停止工作 // 纵向 // iOS 7

如何全屏模式自定义视频播放器并在全屏打开时向下滚动

Pygame 窗口在全屏模式下没有响应