j0j*_*0j0 5 c position calayer ios ios-4.2
更新到iOS 4.2 SDK后,我在我的应用程序中收到以下异常:
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 22]'
Run Code Online (Sandbox Code Playgroud)
(请参阅下面的调用堆栈副本)
细节:
' - UIWebView里面有视频标签UIScrollView
' - 视频可以在里面播放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'
Run Code Online (Sandbox Code Playgroud)
小智 0
我对于继承 UIScrollView 的类也遇到了同样的问题。解决方案非常奇怪:我没有使用“initWithFrame”,而是使用“init”并在下一行中手动设置框架。这为我解决了问题。
该问题仅发生在一个特定对象上 - 我在程序的其他部分中使用“initWithFrame”创建了相同类型的对象,没有出现问题。该问题也仅出现在装有 iOS 4.2 的 iPhone 4 上。它确实在运行 iOS 4.1 的 iPhone 4 和运行 iOS 4.2 的 iPad 上运行没有问题。