-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal Exception: CALayerInvalidGeometry CALayer bounds contains NaN #1173
Comments
What version are you using? |
Hi,
iOS: 13.1.3 Thank you |
@jansvancer are you experiencing this in production? or development. |
@patchthecode both, production and development.
before calling reloadData. But I'm not sure if this is the right solution and why this happens only in one specific case. The actual crash happens at line 157 in JTACMonthLayout.swift
Hope this helps at least a little bit. Thank you |
We just updated our app to use JTAppleCalendar and we are also seeing this issue in production. We are calling A simple fix for this on the libraries side could be to verify the x and y points using isNaN. |
@bsweett are you also using version 7? (and not version 8) |
The reason why I have been slow to update this is because. It is hard for me to update so many versions. |
We are using version 8.0.3. Here is our stack trace:
|
@bsweett hmm. By any chance does your calendar change size? or anything like that? There are two places in the source code I suspect is casing this. This bug should have been caught in development though. Let me do a check. I have not merged it yet though. |
Yes we do change the calendar size for two reasons:
I'm not sure that this is the specific cause though as our logs just show the user launching the controller with the calendar. We reload the data in the calendar when the view appears incase something changed from a view deeper in the navigation stack. It seems like some point being sent to the collection view is invalid: |
We resolved this on our end by changing the scrolling mode to I would still advise that the library verify the |
EDIT: Nevermind, @bsweett 's fix did not work for me. I'm still seeing the error which results in a crash: *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [nan 0; 0 0]. Layer: <CALayer:0x7b0800157660; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <JTAppleCalendar.JTACMonthView: 0x7b7c000b0c00; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7b0c00062d30>; layer = <CALayer: 0x7b0800157660>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <JTAppleCalendar.JTACMonthLayout: 0x7b580012e700>; dataSource: <JTAppleCalendar.JTACMonthView: 0x7b7c000b0c00; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7b0c00062d30>; layer = <CALayer: 0x7b0800157660>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <JTAppleCalendar.JTACMonthLayout: 0x7b580012e700>; dataSource: <JTAppleCalendar.JTACMonthView: 0x7b7c000b0c00>>>; masksToBounds = YES; allowsEdgeAntialiasing = NO; backgroundColor = <CGColor 0x7b14000361f0> [<CGColorSpace 0x7b180004db80> (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Profil gamma 2.2 gris générique; extended range)] ( 0 0 )>' @patchthecode This is only happening when I'm showing the calendar inside a popOver. I'm really not sure what's causing this. Do you have any idea what could be the culprit here? Here is how I set up my calendar:
Regarding the layout, The calendar is inside a container view of fixed width 350 and is pin to the latter's 4 edges. Height and cellSize are calculated based off of the width. |
@patchthecode We have the same issue with scrolling. At |
Hey @rafalwojcik, is your calendar presented in a popover? |
No, the issue occurs only when the calendar is initially hidden and we are using It crashes right there (
|
Thank you for letting me know how to reproduce it |
@patchthecode nice. Thank you when do you have a plan to release new version? I can create PR to fix that but we need this fix to be oficially released :) |
2 solutions I can think of: Solution 2 might be the better one here. |
@rafalwojcik i can create a minor release probably the same time as well. It will be version 8.0.4 |
@rafalwojcik If you can create a PR this will be awesome, as I am swamped with work. |
Hi I have encountered the following crashes on my app, happening in both iOS 12.4 and 13.x devices. However I am not able to reproduce this crash. Is there a way to solve this?
Thanks for the amazing library.
(Required) Version Number:
7.1.8
Fatal Exception: CALayerInvalidGeometry
CALayer bounds contains NaN: [nan 0; 0 0]. Layer: <CALayer:0x281d81e00; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <JTAppleCalendar.JTAppleCalendarView: 0x1048a5400; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x281300210>; layer = <CALayer: 0x281d81e00>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <JTAppleCalendar.JTAppleCalendarLayout: 0x11b574e20>; dataSource: <JTAppleCalendar.JTAppleCalendarView: 0x1048a5400; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x281300210>; layer = <CALayer: 0x281d81e00>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <JTAppleCalendar.JTAppleCalendarLayout: 0x11b574e20>; dataSource: <JTAppleCalendar.JTAppleCalendarView: 0x1048a5400>>>; sublayers = (<CALayer: 0x281dcc740>); masksToBounds = YES; allowsGroupOpacity = YES; backgroundColor = <CGColor 0x283ebcff0> [<CGColorSpace 0x28398a940> (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Generic Gray Gamma 2.2 Profile; extended range)] ( 1 1 )>
Last Exception Backtrace (0)#0 (null) in __exceptionPreprocess ()
#1 (null) in objc_exception_throw ()
#2 (null) in +[NSException raise:format:] ()
#3 (null) in CA::Layer::set_bounds(CA::Rect const&, bool) ()
#4 (null) in -[CALayer setBounds:] ()
#5 (null) in -[UIView(Geometry) setBounds:] ()
#6 (null) in -[UIScrollView setBounds:] ()
#7 (null) in -[UICollectionView setBounds:] ()
#8 (null) in -[UIScrollView setContentOffset:] ()
#9 (null) in -[UICollectionView setContentOffset:] ()
#10 (null) in -[UIScrollView _setContentOffset:animated:animationCurve:animationAdjustsForContentOffsetDelta:an... ()
#11 (null) in -[UICollectionView setContentOffset:animated:] ()
#12 0x101f6622c in JTAppleCalendarLayout.prepare() at /Users/rm/Documents/Project/TripO/Pods/JTAppleCalendar/Sources/JTAppleCalendarLayout.swift:154
#13 (null) in @objc JTAppleCalendarLayout.prepare() ()
#14 (null) in -[UICollectionViewData _prepareToLoadData] ()
#15 (null) in -[UICollectionViewData validateLayoutInRect:] ()
#16 (null) in -[UICollectionView layoutSubviews] ()
#17 0x101f4f698 in JTAppleCalendarView.layoutSubviews() at /Users/rm/Documents/Project/TripO/Pods/JTAppleCalendar/Sources/InternalActionFunctions.swift:28
#18 (null) in @objc JTAppleCalendarView.layoutSubviews() ()
#19 (null) in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#20 (null) in -[CALayer layoutSublayers] ()
#21 (null) in CA::Layer::layout_if_needed(CA::Transaction*) ()
#22 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#23 (null) in CA::Context::commit_transaction(CA::Transaction*, double) ()
#24 (null) in CA::Transaction::commit() ()
#25 (null) in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
#26 (null) in display_timer_callback(__CFMachPort*, void*, long, void*) ()
#27 (null) in __CFMachPortPerform ()
#28 (null) in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION ()
#29 (null) in __CFRunLoopDoSource1 ()
#30 (null) in __CFRunLoopRun ()
#31 (null) in CFRunLoopRunSpecific ()
#32 (null) in GSEventRunModal ()
#33 (null) in UIApplicationMain ()
#34 0x100c43018 in main at /Users/j/Documents/Project/Navagio/Controller/DateEditController.swift:24
The text was updated successfully, but these errors were encountered: