iOS 8 rotation issue


#1

Hi all,

I have this strange problem. Everything is working perfect in iOS 7, but on iOS 8 my app crashes in a strange (or not so strange) way. When i rotate my app Shinobi charts produces various crashes with this method “rotatesOnDeviceRotation” (i have set my chart rotatesOnDeviceRotation to NO). For example:

[SChartLightTheme rotatesOnDeviceRotation]: unrecognized selector sent to instance …
[SChartTitle rotatesOnDeviceRotation]: unrecognized selector sent to instance

Now, those errors are only produced in the screen with Shinobi - if i remove shinobi chart from the screen it’s not crashing, which means it’s something related to Shinobi. I have implemented the new “- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator” for iOS 8 too. The Shinobi examples are working fine by themselves, which also means there’s something in my app. But for the life of me - can’t see what’s wrong. If there is a way to supress this method from being sent down the shinobi view hierarchy …

Any help, tips or advices would be greatly appreciated. Thanks!

EDIT: I am also getting this kind of error : 

[SChartCanvas viewAboutToRotate]

The thing is that i have two different layout for a screen for portrait and landscape and on rotation i am changing the UI completly, including alloc-ing a new ShinobiChart. Also, narrowed it down to upside down orientation - if i don’t go through it everything is fine, but from upside down going to landscape it crashes. I have all the orientations enabled for the app.

Cheers,
S.


#2

Hi Supudo,

I modified our sample application based on the information you provided but I couldn’t replicate the crash. Correct me if I got anything wrong, but here’s what I did:

  • I took our getting sample guide cut out as much chart code as possible and made the chart full screen.
  • I set the chart’s rotatesOnDeviceRotation property to NO.
  • Implemented viewWillTransitionToSize:… to initialize a new chart when turning horizontal (size.width > size.height) and place the two charts side by side, and to place the original chart to full screen when vertical.

No matter how much I spin this chart around I can’t seem to replicate the crash. I think my best suggestion here would be to try to isolate your chart containing view controller in a seperate sample application. You should aim to pull out the view controller and remove all non-chart specific code. You’ll either find that removing a certain line of code will stop the issue, or you’ll have the perfect sample application to email into info@shinobicontrols.com. Either way, we’ll have a definitive place to start investigating this issue, and hopefully get a fix out.

If you do want to send us anything, you can either upload it somewhere (with the ShinobiCharts framework removed!) or email your project in referencing this blog post and we’ll do our best to help! Without being able to replicate it on our side, it’s quite difficult to get started.  :grin:

Thanks,
Jan


#3

Hi Jan,

Thanks for the quick response. Turns out your idea to localize the code and the problem helped. The problem was that after rotation i was recreating the chart and eveyrhing else. But this was executed in background - just put in in the main thread and works like a charm. So, for the record - it didn’t always crashed in the Shinobi components, but also in NSCFString, NSDateFormatter, etc. - whatever was hit first.

Thanks!
S.


#4

I’m always happy to help! Good luck with the rest of your development.

Jan