HTML5 视频播放期间发生 CALayerInvalidGeometry 异常
更新到 iOS 4.2 SDK 后,我的应用程序中收到以下异常:(
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 22]'
请参阅下面的调用堆栈副本)
详细信息:
'- UIWebView
with video tag is inside UIScrollView< /code>
'- 视频可以在 UIWebView
内播放,但是当尝试放大并使用播放器中的缩小或完成按钮时,应用程序会因上述异常而崩溃。 SDK 3.2 上不会发生这种情况
*** Call stack at first throw:
(
0 CoreFoundation 0x01150be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x012a55c2 objc_exception_throw + 47
2 CoreFoundation 0x01109628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0110959a +[NSException raise:format:] + 58
4 QuartzCore 0x0200996a _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 177
5 QuartzCore 0x020098b5 -[CALayer setPosition:] + 42
6 QuartzCore 0x020097cc -[CALayer setFrame:] + 763
7 UIKit 0x0030d307 -[UIView(Geometry) setFrame:] + 255
8 UIKit 0x003e6add -[UISlider setFrame:] + 166
9 MediaPlayer 0x00f0faee -[MPDetailSlider setFrame:] + 78
10 MediaPlayer 0x00f267b7 -[MPWildcatFullScreenVideoOverlay layoutSubviews] + 1280
11 QuartzCore 0x0200e451 -[CALayer layoutSublayers] + 181
12 QuartzCore 0x0200e17c CALayerLayoutIfNeeded + 220
13 QuartzCore 0x0200737c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
14 QuartzCore 0x020070d0 _ZN2CA11Transaction6commitEv + 292
15 QuartzCore 0x020377d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
16 CoreFoundation 0x01131fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
17 CoreFoundation 0x010c70e7 __CFRunLoopDoObservers + 295
18 CoreFoundation 0x0108fbd7 __CFRunLoopRun + 1575
19 CoreFoundation 0x0108f240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x0108f161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x01a85268 GSEventRunModal + 217
22 GraphicsServices 0x01a8532d GSEventRun + 115
23 UIKit 0x002e642e UIApplicationMain + 1160
24 ecom 0x000022c0 main + 102
25 ecom 0x00002251 start + 53
)
terminate called after throwing an instance of 'NSException'
After updating to the iOS 4.2 SDK, I receive the following exception in my app:
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 22]'
(Please see below for the copy of call stack)
Details:
'- UIWebView
with video tag is inside UIScrollView
'- Video can play inside UIWebView
, but when tried to zoom in, and use either zoom-out or done button from the player, the app crashes with the said exception.
This doesn't happen on SDK 3.2
*** Call stack at first throw:
(
0 CoreFoundation 0x01150be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x012a55c2 objc_exception_throw + 47
2 CoreFoundation 0x01109628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0110959a +[NSException raise:format:] + 58
4 QuartzCore 0x0200996a _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 177
5 QuartzCore 0x020098b5 -[CALayer setPosition:] + 42
6 QuartzCore 0x020097cc -[CALayer setFrame:] + 763
7 UIKit 0x0030d307 -[UIView(Geometry) setFrame:] + 255
8 UIKit 0x003e6add -[UISlider setFrame:] + 166
9 MediaPlayer 0x00f0faee -[MPDetailSlider setFrame:] + 78
10 MediaPlayer 0x00f267b7 -[MPWildcatFullScreenVideoOverlay layoutSubviews] + 1280
11 QuartzCore 0x0200e451 -[CALayer layoutSublayers] + 181
12 QuartzCore 0x0200e17c CALayerLayoutIfNeeded + 220
13 QuartzCore 0x0200737c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
14 QuartzCore 0x020070d0 _ZN2CA11Transaction6commitEv + 292
15 QuartzCore 0x020377d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
16 CoreFoundation 0x01131fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
17 CoreFoundation 0x010c70e7 __CFRunLoopDoObservers + 295
18 CoreFoundation 0x0108fbd7 __CFRunLoopRun + 1575
19 CoreFoundation 0x0108f240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x0108f161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x01a85268 GSEventRunModal + 217
22 GraphicsServices 0x01a8532d GSEventRun + 115
23 UIKit 0x002e642e UIApplicationMain + 1160
24 ecom 0x000022c0 main + 102
25 ecom 0x00002251 start + 53
)
terminate called after throwing an instance of 'NSException'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
自 iOS 4.2 起,MoviePlayer 内滑块的帧大小计算似乎存在问题。
如果框架的宽度设置在143.0和235.0之间,则会发生此异常。
Since iOS 4.2 there seems to be an issue with the calculations of the frame size for the slider inside the MoviePlayer.
If the width of the frame is set between 143.0 and 235.0 this exception occurs.
我在 UIScrollView 中看到了类似的问题。我在 iOS 文档中注意到这个警告:
我在滚动视图中嵌入了一个 UITextView。删除它解决了我的问题。
I was seeing a similar issue with my UIScrollView. I noticed this warning in the iOS docs:
I had a UITextView embedded within the scrollView. Removing that fixed the issue for me.
我对于继承 UIScrollView 的类也遇到了同样的问题。解决方案非常奇怪:我没有使用“initWithFrame”,而是使用“init”并在下一行中手动设置框架。这为我解决了问题。
该问题仅发生在一个特定对象上 - 我在程序的其他部分中使用“initWithFrame”创建了相同类型的对象,没有出现问题。该问题也仅出现在装有 iOS 4.2 的 iPhone 4 上。它确实在运行 iOS 4.1 的 iPhone 4 和运行 iOS 4.2 的 iPad 上运行没有问题。
I also had the same problem with a class inheriting from a UIScrollView. The solution was pretty odd: Instead of using "initWithFrame" I just used "init" and set the frame manually in the next line. This solved the problem for me.
The problem occured only on one specific object - I created objects of the same type with "initWithFrame" in other parts of my program without problems. The problem also occured only on an iPhone 4 with iOS 4.2. It did worked without problems on iPhone 4 with iOS 4.1 and on an iPad with iOS 4.2.
我开始对 4.2 和 Xcode 4.2.5 有相同的期望(仅在模拟器中 - 从未在真正的 4.2 设备上)以及用于单元格渐变背景的 CAGradientLayer 代码 - 否则工作正常 在少数其他应用程序中,
幸运的是,
用 Try-Catch 块包围代码有时确实会产生期望,但没有出现可见的伪影,所有单元格仍然具有渐变背景。
I've started having the same expcetions with 4.2 and Xcode 4.2.5 (only in simulator - never on the real 4.2 device) and with CAGradientLayer code for gradient-background for cells - which is otherwise working fine on handful of other applications ,
luckily,
surrounding the code with Try-Catch block does produce expcetion sometimes, but no visible artefacts appear, all the cells do still have gradient backgrounds.