gpt4 book ai didi

ios - 调试 'CALayer position contains NaN: [nan nan]'

转载 作者:行者123 更新时间:2023-11-28 08:13:34 30 4
gpt4 key购买 nike

在将 Xcode 更新到 8.3 后,我在启动时开始收到此错误:由于未捕获的异常“CALayerInvalidGeometry”而终止应用程序,原因:“CALayer 位置包含 NaN:[nan nan]”

我的应用程序的主视图有几个容器 View ,其中一个包含一个 mapView。看来错误与 map 有关,但我无法从消息中完全弄清楚那可能是什么。任何想法将不胜感激!

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
*** First throw call stack:
(
0 CoreFoundation 0x00000001029b1b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102416141 objc_exception_throw + 48
2 CoreFoundation 0x0000000102a1a625 +[NSException raise:format:] + 197
3 QuartzCore 0x00000001039d90be _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 152
4 QuartzCore 0x00000001039d9231 -[CALayer setPosition:] + 43
5 MapKit 0x000000010354a97b -[MKMapView _updateScrollContainerView:] + 1214
6 MapKit 0x000000010354bbeb -[MKMapView _sizeDidChangeWithCenterCoordinate:] + 55
7 MapKit 0x000000010354606e -[MKMapView setBounds:] + 271
8 UIKit 0x0000000103c14b23 -[UIView(Geometry) _applyISEngineLayoutValuesToBoundsOnly:] + 598
9 UIKit 0x0000000103c14e0e -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 125
10 CoreFoundation 0x0000000102942652 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
11 CoreFoundation 0x000000010294256f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
12 UIKit 0x0000000103c1387c -[UIView(Geometry) resizeSubviewsWithOldSize:] + 183
13 UIKit 0x000000010452f1f9 -[UIView(AdditionalLayoutSupport) _is_layout] + 168
14 UIKit 0x0000000103c1fd56 -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 994
15 UIKit 0x0000000103c3120b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
16 QuartzCore 0x00000001039e2904 -[CALayer layoutSublayers] + 146
17 QuartzCore 0x00000001039d6526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370
18 QuartzCore 0x00000001039d63a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
19 QuartzCore 0x0000000103965e92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
20 QuartzCore 0x0000000103992130 _ZN2CA11Transaction6commitEv + 468
21 QuartzCore 0x0000000103992b37 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 115
22 CoreFoundation 0x0000000102957717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
23 CoreFoundation 0x0000000102957687 __CFRunLoopDoObservers + 391
24 CoreFoundation 0x000000010293c038 CFRunLoopRunSpecific + 440
25 UIKit 0x0000000103b6802f -[UIApplication _run] + 468
26 UIKit 0x0000000103b6e0d4 UIApplicationMain + 159
27 Pulley 0x0000000101bd95b7 main + 55
28 libdyld.dylib 0x0000000109eaa65d start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

最佳答案

您似乎正在使用 CALayer 对象执行 setPosition: 并且 CALayer 对象为 nil。这就是您的应用崩溃的原因。

请通过if语句检查CALayer是否为nil

关于ios - 调试 'CALayer position contains NaN: [nan nan]',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43086753/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com