2010-12-06 51 views
5

更新到iOS 4.2的SDK後,我收到以下異常在我的應用程序:CALayerInvalidGeometry例外玩

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 22]' 

(請參見下面的調用堆棧的副本)

詳細信息:

' - 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' 

回答

0

發生,我也有同樣的問題用一個類從一個UIScrollView繼承。解決方案很奇怪:我不是使用「initWithFrame」,而是使用「init」並在下一行中手動設置框架。這解決了我的問題。

只發生在一個特定對象上的問題 - 我在程序的其他部分創建了與「initWithFrame」相同類型的對象,沒有任何問題。這個問題也只發生在使用iOS 4.2的iPhone 4上。它確實在iOS 4.1的iPhone 4和iOS 4.2的iPad上都沒有問題。

6

從iOS 4.2開始,似乎存在MoviePlayer中滑塊的幀大小的計算問題。

如果幀的寬度設置143.0235.0這種異常發生之間。

1

我看到與我的UIScrollView類似的問題。我注意到,在iOS的文檔這樣的警告:

重要:您不應該在 的UIScrollView對象嵌入 的UIWebView或UITableView的對象。如果這樣做, 可能會導致意外的行爲,因爲 兩個對象的觸摸事件 可能混淆並被錯誤地處理。

我有一個嵌入在scrollView中的UITextView。刪除,解決了我的問題。

0

我已經開始具有相同expcetions 4.2和4.2.5的Xcode(僅在模擬器 - 從未真正4.2設備上),並用梯度-背景細胞CAGradientLayer碼 - 其否則精細上工作極少數的其他應用程序,

幸運的是,

與周圍的try-catch塊中的代碼確實有時會產生expcetion,但沒有明顯的文物出現,所有的細胞都仍然有漸變背景。