Skip to content
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

Crash when tapping on Radio Element #717

Open
bgraner opened this issue Jul 28, 2015 · 8 comments
Open

Crash when tapping on Radio Element #717

bgraner opened this issue Jul 28, 2015 · 8 comments

Comments

@bgraner
Copy link
Contributor

bgraner commented Jul 28, 2015

I have a radio element that when I tap occasionally will crash with the following stack trace:

2015-07-28 14:30:13.512 FarmAtHand[321:60482] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 nan; 320 360]'
*** First throw call stack:
(0x185a382d8 0x1973940e4 0x185a38218 0x189ddfdc8 0x189ddfc74 0x18a4fd418 0x18a50c85c 0x18a590ef0 0x18a4ccd1c 0x18a582a2c 0x18a56091c 0x100360a8c 0x18a4c7f08 0x18a566544 0x18a565f30 0x18a565c50 0x18a565bd0 0x18a4ad6f4 0x189de9db8 0x189de4820 0x189de46c4 0x189de3e58 0x189de3bd8 0x189ddd300 0x1859f02a4 0x1859ed230 0x1859ed610 0x1859192d4 0x18f21f6fc 0x18a516f40 0x100122c0c 0x197a3ea08)
libc++abi.dylib: terminating with uncaught exception of type NSException

This happens in line 122 of QuickDialogController:
if (_root.preselectedElementIndex !=nil) [self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO];

Any idea why this happens?

@PatrickNLT
Copy link
Contributor

Are you using iOS 9? I'm encountering a similar issue.

@nbonamy
Copy link

nbonamy commented Sep 17, 2015

+1

@sadnessleaf
Copy link

Temporary fixed by comment out these two lines. Works fine with my code.

/*
if (_root.preselectedElementIndex !=nil)
[self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO];
*/

@nbonamy
Copy link

nbonamy commented Sep 18, 2015

Did the same in https://github.com/nbonamy/QuickDialog. I rarely have a lot of items in my RadioElement so no scrolling is not a big issue.
Using it with
pod 'QuickDialog', :git => 'https://github.com/nbonamy/QuickDialog'

@PatrickNLT
Copy link
Contributor

I made a fix and created a pull request a while ago: #720

@iNiKe
Copy link
Contributor

iNiKe commented Oct 4, 2015

A bit better way to fix it temporary:

        @try {
            if (_root.preselectedElementIndex !=nil)
                [self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO];
        }
        @catch (NSException *exception) { }

@PatrickNLT
Copy link
Contributor

The real fix is in #720

@matan23
Copy link

matan23 commented Nov 3, 2015

@iNiKe @PatrickNLT PR seems to fix the issue, however in QuickDialogController.m

- (void)viewWillAppear:(BOOL)animated {
    _viewOnScreen = YES;
    [self.quickDialogTableView deselectRows];
    [super viewWillAppear:animated];
    if (_root!=nil) {
        self.title = _root.title;
        self.navigationItem.title = _root.title;
        if (_root.preselectedElementIndex !=nil)
            [self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO];

    }
}

In viewWillAppear, is the controller really ready to scroll as the view is not layed out yet? I fixed it by moving the scrolling line to viewDidAppear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants