【问题标题】:Swift youtube ios helper fullscreen throws exceptionSwift youtube ios 助手全屏抛出异常
【发布时间】:2025-12-03 11:55:02
【问题描述】:
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-03-06 18:30:19.141870+0100 Myapp[1125:200711] *** Assertion failure in -[UIView _nsis_center:bounds:inEngine:forLayoutGuide:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.21.8/NSLayoutConstraint_UIKitAdditions.m:3322
2018-03-06 18:30:19.142162+0100 Myapp[1125:200711] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error in compatibility flow'
*** First throw call stack:
(0x181f31d04 0x181180528 0x181f31bd8 0x1828c1c24 0x18be652a4 0x18c0bed04 0x18c0beee4 0x193a6f418 0x193a6ee20 0x18b3662f8 0x185f1fec8 0x185f23fa8 0x18b37b09c 0x18adf790c 0x18adf3c38 0x106db549c 0x106db545c 0x106dba050 0x181ed9eb0 0x181ed7a8c 0x181df7fb8 0x183c8ff84 0x18b3cc2e8 0x10483fca4 0x18191a56c)
libc++abi.dylib: terminating with uncaught exception of type NSException

当我尝试使用 YouTube Helper library 加载 youtube 视频时,我收到此日志。

我在一个单元格中实现了 YTPlayerView 并得到了上一个错误。然后我尝试在普通的 UIViewController 中打开它。又是同样的问题。

视频开始内联播放,但是当我单击全屏模式按钮时,我在 AppDelegate 中获得了 SIGABRT。

自从我使用 xcode 9 后就出现了这个问题。对于旧版本,它的工作方式与预期一样。当我在 iOS 10 设备上编译相同的代码时,它正在工作。没有 iOS 11。

我发现 UIWebView 中的 AVPlayer 想要使用约束,但我正在使用 Autolayout...我尝试使用此帖子添加符号断点 How to trap on UIViewAlertForUnsatisfiableConstraints?

【问题讨论】:

    标签: ios swift uiwebview youtube-api avplayerviewcontroller


    【解决方案1】:

    找到原因了。我猜SDK坏了。重新安装 XCODE 就成功了!

    【讨论】: