Crash when setting CALayer's frame
Closed this issue · 2 comments
cravemusic commented
Overall setup:
View controller inside of a popover
Add slider as only view in VC's viewDidLoad, no XIBs or Storyboards involved
Crash here:
[ASValuePopUpView setArrowCenterOffset:]
[ASValueTrackingSlider adjustPopUpViewFrame]
[ASValueTrackingSlider positionAndUpdatePopUpView]
[ASValueTrackingSlider setup]
[ASValueTrackingSlider initWithFrame:] // crash with either CGRectZero or CGRectMake(0, 0, 320, 30)
[MyViewController viewDidLoad]
[UIViewController loadViewIfRequired] ()
[UIViewController view] ()
[UINavigationController preferredContentSize] ()
[UIViewController(UIPopoverController_Internal) _resolvedPreferredContentSize] ()
[UIPopoverController _transitionFromViewController:toViewController:animated:] ()
[UIPopoverController _initWithContentViewController:popoverControllerStyle:] ()
on line
self.layer.frame = f; // changing anchor repositions layer, so must reset frame afterwards
CGRect f = self.layer.frame; // This looks like CGRectZero before crash
Message:
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 0]'
iOS SDK 7.1, iOS 7.1.1
alskipp commented
Thank you for reporting this. I think a quick fix for the issue would be this: In the method - (void)setup
of ASValueTrackingSlider.m
, replace the following line
self.popUpView = [[ASValuePopUpView alloc] initWithFrame:CGRectZero];
with this:
self.popUpView = [[ASValuePopUpView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
I will investigate this further to work out if this is the best way to solve the problem.
Do let me know if this quick fix solves the issue for you.
Cheers,
Al
alskipp commented
Fixed in current master branch. Podspec will be updated later today.