Jawbone / JBChartView

iOS-based charting library for both line and bar graphs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JBLineChart reloadData problem

opened this issue · comments

This same error keeps happening...


*** Assertion failure in -[JBLineChartView padding], /...MyApp/Pods/JBChartView/Classes/JBLineChartView.m:455
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView )lineChartView'
*
* First throw call stack:
(0x186c282d8 0x1983fc0e4 0x186c28198 0x187adced4 0x10005b6f0 0x100061f90 0x18b7ffd8c 0x18b69c8f8 0x18b695f68 0x18b66918c 0x18b90a324 0x18b6676a0 0x186be0240 0x186bdf4e4 0x186bdd594 0x186b092d4 0x1903276fc 0x18b6cefac 0x10003b46c 0x198a7aa08)
libc++abi.dylib: terminating with uncaught exception of type NSException


I did check by adding:
if (!self.dataSource){
NSLog(@"nil datasource");
}

Update on Aug 11th, 2015
Everything's all right when I set dataSource & delegate for the chart.
Problem was caused when [chart reloadData] got called;
dataSource became nil this time inside the - (CGFloat)padding method,
where exception threw at this line:

NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");

It sounds like your datasource is being dealloc'd in some way. Doesn't sound to be an internal issue with the chart library, but rather how your managing the chart's delegation.

Step through the code again and see how your managing the chart's .datasource and .delegate. Watch for nil's!

You were right!
my class instance as the chart's dataSource got dealloc.
I stored it in strong property and no more issue there!
Thanks for help!