Search code examples
iosios5ios6

ios - can there be a segue crash only in some cases?


I just got a crashalytics report that my app crashed on a segue. This is the error:

Exception Type: NSGenericException
Reason: Could not find a navigation controller for segue 'AskToQuestion'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.

But when I ran my app to try to reproduce this (same version of the app as in the error) I could not simply reproduce it. And it seems other users are also using this fine.

Would there be a possible reason why this crashed only for a small number of devices?

Thank you!


Solution

  • I would guess that it isn't a matter of particular devices, but that there is a use case you have not stumbled upon. In other words, there is a bug such that sometimes it is possible to wind up in this particular UIViewController but not inside a UINavigationController. Hence when we try to do the push segue from this situation, we rightly crash. The trouble is, of course, that you do not know how to wind up in this situation. If you can't figure it out, you might have to put out an instrumented version of the app, i.e. it puts out log messages such that you can work out how we got here.