I am trying to make my application work with both iOS7 and iOS8, and I ran into a problem in my prepareForSegue methods in my controllers.
In iOS8, segue.destinationViewController has a UINavigationController class, so I use [[segue.desinationViewController viewControllers] objectAtIndex:0] , which works fine, but in iOS7 segue.desinationViewController has a CMAMyViewControllerClassName class, which will obviously throw an error message when I try to viewContollers .
I found this solution that will work, but I was wondering if there is a better solution? Apart from the last message, I could not find anything. If there is no βrightβ solution, I will create a method that gets the correct view controller; I'm just wondering how other people dealt with this situation.
Thanks!
source share