我遇到了这个奇怪的问题,我无法解决这个问题。问题是应用程序在mac os x 10.9上不断崩溃,但在10.10上它运行正常。我正在使用xcode 6。
App使用* .xib文件,并且存在以编程方式创建的视图。
由于 CALayerInvalidGeometry 异常,崩溃在发布时发生。
奇怪的是,如果'显示滚动条'系统偏好设置为'滚动时'或者'永远',app工作得很好。 '自动基于输入设备'导致应用崩溃。
另一个观察是,当应用程序运行并提到偏好设置被切换时(例如,当滚动到'总是')时会抛出相同的异常,但它不会导致应用程序崩溃。但无效的矩形传递给CoreUI:{{nan,nan},{nan,nan}} 显示在输出中。
我已经检查了在发布期间初始化的所有视图,但我找不到任何错误。并且根据调用堆栈没有可能引发崩溃的直接调用。
另一个观察是当执行___NSDetectScrollDevicesThenInvokeOnMainQueue_block_invoke_2时发生崩溃。我无法找到有关它的更多信息。
2015-05-18 19:26:09.039 MyApp[24355:303] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
*** Call stack at first throw:
(
0 CoreFoundation 0x9bcab471 __raiseError + 193
1 libobjc.A.dylib 0x995c9091 objc_exception_throw + 162
2 CoreFoundation 0x9bcab38b +[NSException raise:format:] + 139
3 QuartzCore 0x97319d30 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 190
4 QuartzCore 0x97319c6d -[CALayer setPosition:] + 55
5 QuartzCore 0x9731b895 -[CALayer setFrame:] + 807
6 AppKit 0x9852dcaf -[NSScrollerImp _updateLayerGeometry] + 293
7 AppKit 0x9852dae7 -[NSScrollerImp setKnobProportion:] + 63
8 AppKit 0x98687ee1 -[NSScroller setKnobProportion:] + 210
9 AppKit 0x98532fa5 -[NSScrollView reflectScrolledClipView:] + 1238
10 AppKit 0x9853d944 -[NSClipView _reflectDocumentViewFrameChange] + 157
11 AppKit 0x9853d8a0 -[NSClipView _handleFrameChangeForSubview:] + 50
12 AppKit 0x98500cac -[NSView _postFrameChangeNotification] + 166
13 AppKit 0x9850a28e -[NSView setFrameSize:] + 1541
14 AppKit 0x986a5a97 -[NSTextView(NSPrivate) _setFrameSize:forceScroll:] + 750
15 AppKit 0x986a579e -[NSTextView setFrameSize:] + 63
16 AppKit 0x98509c51 -[NSView setFrame:] + 256
17 AppKit 0x9858beec -[NSView resizeWithOldSuperviewSize:] + 949
18 AppKit 0x98534d29 -[NSView resizeSubviewsWithOldSize:] + 351
19 AppKit 0x9850a18f -[NSView setFrameSize:] + 1286
20 AppKit 0x9853483b -[NSClipView setFrameSize:] + 407
21 AppKit 0x98509c51 -[NSView setFrame:] + 256
22 AppKit 0x98537725 -[NSScrollView _setContentViewFrame:] + 591
23 AppKit 0x985355d6 -[NSScrollView tile] + 1717
24 AppKit 0x98785142 -[NSScrollView setScrollerStyle:] + 481
25 AppKit 0x98785214 -[NSScrollView(NSPrivate) scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:] + 188
26 AppKit 0x98ec3e76 +[NSScrollerImpPair _updateAllScrollerImpPairsForNewRecommendedScrollerStyle:] + 407
27 AppKit 0x98ec3f70 +[NSScrollerImpPair _scrollerStyleRecommendationChanged:] + 159
28 Foundation 0x9bd5d992 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 49
29 CoreFoundation 0x9bc745a4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
30 CoreFoundation 0x9bb5604b _CFXNotificationPost + 3435
31 Foundation 0x9bd4c47f -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
32 AppKit 0x98ec33c9 -[_NSScrollerStyleRecommender setRecommendedScrollerStyleAndNotify:] + 337
33 AppKit 0x98ec34b9 __75-[_NSScrollerStyleRecommender scrollerStyleRecommendationUpdateTimerFired:]_block_invoke + 43
34 AppKit 0x98eaefcb ___NSDetectScrollDevicesThenInvokeOnMainQueue_block_invoke_2 + 32
35 libdispatch.dylib 0x02645800 _dispatch_call_block_and_release + 15
36 libdispatch.dylib 0x02641839 _dispatch_client_callout + 50
37 libdispatch.dylib 0x0264bff8 _dispatch_main_queue_callback_4CF + 445
38 CoreFoundation 0x9bc04fae __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
39 CoreFoundation 0x9bbbc3c9 __CFRunLoopRun + 1897
40 CoreFoundation 0x9bbbb9ea CFRunLoopRunSpecific + 394
41 CoreFoundation 0x9bbbb84b CFRunLoopRunInMode + 123
42 HIToolbox 0x93aefb5d RunCurrentEventLoopInMode + 259
43 HIToolbox 0x93aef8e2 ReceiveNextEventCommon + 526
44 HIToolbox 0x93aef6bd _BlockUntilNextEventMatchingListInModeWithFilter + 92
45 AppKit 0x984d1349 _DPSNextEvent + 1602
46 AppKit 0x984d0870 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
47 AppKit 0x984c315c -[NSApplication run] + 727
48 AppKit 0x984abff8 NSApplicationMain + 1165
49 MyApp 0x00262e0b main + 43
50 MyApp 0x00003115 start + 53
)