Xcode 9 / iOS 11 “Los límites de CALayer contienen NaN: [nan 0; nan 0] "cuando aparece el controlador de vista con UINavigationController anidado y UITabBarController
Estoy actualizando mi aplicación para Xcode 9, Swift 4, iOS 11 y el iPhone X. Parece que todo funciona relativamente bien, pero cada vez que presiono el botón Atrás mi aplicación falla. Puedo avanzar 3-4 pantallas sin ningún problema, pero el primer botón de retroceso bloquea la aplicación, siempre. No requiere que el simulador se ejecute como un iPhone X.
No parece sumergirse en mi código en el seguimiento de la pila, por lo que esta es, en mi opinión, la fase de redibujo del controlador de vista al que estoy apareciendo, pero no estoy seguro.
Dado que hago un poco de dibujo personalizado porque hay sombras personalizadas alrededor de UITableViews y UIViews, configuro puntos de interrupción en todas las ubicaciones donde divido por una variable, pero nada se ve afectado. Por lo tanto, no parece ser mi código el que hace el cálculo por cero.
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [nan 0; nan 0]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010af711cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a8d3f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010afe5b95 +[NSException raise:format:] + 197
3 QuartzCore 0x0000000109424424 _ZN2CA5Layer10set_boundsERKNS_4RectEb + 230
4 QuartzCore 0x0000000109414c29 -[CALayer setBounds:] + 251
5 UIKit 0x0000000107267439 __27-[_UILabelLayer setBounds:]_block_invoke + 80
6 UIKit 0x000000010726717b -[_UILabelLayer _setFrameOrBounds:settingAction:] + 23
7 UIKit 0x00000001072673d8 -[_UILabelLayer setBounds:] + 155
8 QuartzCore 0x000000010941537c -[CALayer setFrame:] + 630
9 UIKit 0x0000000107267319 __26-[_UILabelLayer setFrame:]_block_invoke + 80
10 UIKit 0x000000010726717b -[_UILabelLayer _setFrameOrBounds:settingAction:] + 23
11 UIKit 0x00000001072672b8 -[_UILabelLayer setFrame:] + 155
12 UIKit 0x0000000106c4cf1e -[UIView(Geometry) setFrame:] + 368
13 UIKit 0x0000000106e4ec40 -[UILabel setFrame:] + 141
14 UIKit 0x0000000106fff254 -[UIButton _layoutTitleView] + 248
15 UIKit 0x0000000106fff3cf -[UIButton layoutSubviews] + 250
16 UIKit 0x0000000106c6c551 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1331
17 QuartzCore 0x000000010941b4ba -[CALayer layoutSublayers] + 153
18 QuartzCore 0x000000010941f5a9 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
19 QuartzCore 0x00000001093a81cd _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
20 QuartzCore 0x00000001093d3ae4 _ZN2CA11Transaction6commitEv + 500
21 UIKit 0x0000000106b97f4a _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
22 UIKit 0x00000001074ef960 __handleEventQueueInternal + 6894
23 CoreFoundation 0x000000010af142b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
24 CoreFoundation 0x000000010afb3d31 __CFRunLoopDoSource0 + 81
25 CoreFoundation 0x000000010aef8c19 __CFRunLoopDoSources0 + 185
26 CoreFoundation 0x000000010aef81ff __CFRunLoopRun + 1279
27 CoreFoundation 0x000000010aef7a89 CFRunLoopRunSpecific + 409
28 GraphicsServices 0x00000001104e59c6 GSEventRunModal + 62
29 UIKit 0x0000000106b9dd30 UIApplicationMain + 159
30 My Customer's Application Name 0x000000010475f087 main + 55
31 libdyld.dylib 0x000000010cfedd81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException