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

NSInternalInconsistencyException - JBLineChartView // dataSource must implement #68

Closed
sheharyarn opened this issue Jun 24, 2014 · 9 comments

Comments

@sheharyarn
Copy link

I've been using JBLineChartView and it has been working great, but now I'm getting this error:

*** Assertion failure in -[JBLineChartView padding], /Users/Psycho/Work/ios/bluewave/Pods/JBChartView/Classes/JBLineChartView.m:411
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView'
*** First throw call stack:
(0x309fafd3 0x3b145ccf 0x309faead 0x313a7d5b 0x76f3b 0x746c7 0x3631b 0x33349917 0x332f0c47 0x332f049d 0x33216d79 0x32e9462b 0x32e8fe3b 0x3322beab 0x33c03 0x3321b4cb 0x3321b289 0x333a738b 0x332c4d83 0x332c4b8d 0x332c4b25 0x33216d79 0x32e9462b 0x32e8fe3b 0x32e8fccd 0x32e8f6df 0x32e8f4ef 0x3321a401 0x309c625b 0x309c572b 0x309c3f1f 0x3092ef0f 0x3092ecf3 0x35850663 0x3327a16d 0x126c5 0x3b652ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException

The flow of my app is something like this:

  • I've four UIViewControllers in a Navigation Controller (All push segues) for
    • Year Selection
    • Month Selection (has charts)
    • Day Selection (has charts)
    • Day Details
  • Month and Day Selection UIViewControllers have JBLineChartViews
  • When I select a year, and go into Month Selection the Charts works perfectly
  • If I go further down into Day Selection, the charts works again
  • Now, if I go back to the first ViewController (Pop the views) and repeat the procedure (i.e. Go into Month Selection and Day Selection), the app crashes as soon as the Day Selection View is loaded with the above error.

I can't understand why is this happening, even though I implemented the above mentioned method and the chart loads in Month Selection the second time (but not in the Day Selection).

Here are the JBLineChartView delegate and datasource methods in my Day Selection View Controller:
screen shot 2014-06-24 at 4 55 23 pm

@terryworona
Copy link
Collaborator

Put a breakpoint @ line 411 in JBLineChartView and inspect the dataSource instance at the time of the exception. I'm guessing it's nil.

@sheharyarn
Copy link
Author

Hi, thanks for replying. I tried that and self.datasource at line 411 wasn't nil at any point. Also it didn't stop at the breakpoint just before crashing so I assume something before this line causes that to happen.

screen shot 2014-06-25 at 11 44 54 pm

@terryworona
Copy link
Collaborator

The stack trace points to line 411. Not sure how the breakpoint doesn't trip if it's occurring exactly on that line.

Drop this before:

if (!self.dataSource)
{
   NSLog(@"Foo");
}

& put a breakpoint on the log. See what happens....

@terryworona
Copy link
Collaborator

Or remove the assert on line 411 altogether and see what happens...

@sheharyarn
Copy link
Author

Okay so I commented out the line 411, and the app still crashes with the same error when I follow the same steps, but this time the stack trace points to line 448 which is also an self.dataSource NSAssert for the same selector.

As for the code you gave, yes dataSource is nil:

screen shot 2014-06-26 at 2 43 27 pm

@terryworona
Copy link
Collaborator

When the dataSource is nil, what is the execution path leading up to - (CGFloat)padding? Who is calling it, and when? Screenshot of the full stack would help.

@sheharyarn
Copy link
Author

Can you please explain a little better what you want me to do, I'm new to iOS Development and don't understand XCode very well.

@terryworona
Copy link
Collaborator

Really sorry I can't help you any further. The fact that the dataSource is nil and your catching it at a breakpoint should be more than enough for you to debug the issue.

@sheharyarn
Copy link
Author

After struggling with this for over a week, I shifted to BEMSimpleLineGraph and didn't get any more errors.

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

2 participants