App crash SCHartAxis animateRangeChange Please help!


#1

Used ShinobiCharts in version: shinobicontrols-ios-charts-standard-objc-2.9.0-6.zip

Now we received another Shinobi crash from the Xcode Organizer crash reporter.
The crash happened on an iPad Air 2 with iOS 9.3.5

Please help asap with a solution because this is again a crash on the “Ready for Sale” version of our app

Please find on the attached image the crash information


#2

Hi KK4iOS,

This looks like an error regarding the reference to your chart’s delegate.

I would check you are storing a strong reference to your delegate as the chart only stores a weak reference to it.

If you are still seeing the crash after you’ve checked your references, could you create a small sample that replicates your issue and send it to us at info@shinobicontrols.com linking to this forum post.

That would really help us identify the source of your issue.

Kind regards,
Andrew Polkinghorn.


#3

Dear Andrew,
thank you very much for your quick response.

We are holding a strong reference to the delegate - though, the delegate is a UIViewController that is being popped (unanimated) from a UINavigationController when the user changes the tab on the UITabBarController.

When the user did something like panning or zooming before he changes the tab, and the animation is still ongoing, the ShinobiChart still tries to call methods on its delegate, after the UIViewController is already deallocated.

Meanwhile we now know how to prevent that crash (unfortunately we must never release the vc which should normally pop).

Concerning the crash it looks like to us that the ShinobiChart is using “assign” rather than “weak” for its delegate. With a weak-delegate this crash shouldn’t happen (as it would point to nil).
Or maybe the pointer is used inside a ShinobiChart block without making it strong before using it, or accessing the instance-variable directly?
In any case, for us it looks like Shinobi uses a wrong access-pattern to the delegate-pointer somewhere inside.

I hope the information helps identifying where the root cause could be.

Best regards,

Klaus


#4

Hi Klaus,

Thank you for the detailed response. It is greatly appreciated!

I’ve passed your recommendation to the development team who will discuss it further.

Regarding a work around solution, rather than keeping a strong reference to your view controller you could add the following code to the view controller that controls your chart:

-(void)dealloc {
    _chart.delegate = nil;
}

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.