See demo repository here: https://github.com/markrickert/rmq.view_controller
Steps to reproduce:
bundle
rake
- Type into the REPL:
rmq.view_controller
.
- Switch to a new tab and try again.
- Switch to the "more" tab and try again. Notice it returns a
UIMoreListController
.
- Tap into a view controller in the more tab and try again.
- Crash.
Crashlog produces what looks like an infinite loop. Possible offending code here:
|
def current_view_controller(root_view_controller = nil) |
|
if root_view_controller || ((window = RMQ.app.window) && (root_view_controller = window.rootViewController)) |
|
case root_view_controller |
|
when UINavigationController |
|
current_view_controller(root_view_controller.visibleViewController) |
|
when UITabBarController |
|
current_view_controller(root_view_controller.selectedViewController) |
|
else |
|
if root_view_controller.respond_to?(:visibleViewController) |
|
current_view_controller(root_view_controller.visibleViewController) |
|
elsif root_view_controller.respond_to?(:topViewController) |
|
current_view_controller(root_view_controller.topViewController) |
|
elsif root_view_controller.respond_to?(:frontViewController) |
|
current_view_controller(root_view_controller.frontViewController) |
|
elsif root_view_controller.respond_to?(:center) && (center = root_view_controller.center) && center.is_a?(UIViewController) |
|
current_view_controller(root_view_controller.center) |
|
elsif root_view_controller.respond_to?(:childViewControllers) && root_view_controller.childViewControllers.count > 0 |
|
current_view_controller(root_view_controller.childViewControllers.first) |
|
else |
|
root_view_controller |
|
end |
|
end |
|
end |
|
end |
Note that it also crashes when you just type rmq
into the REPL so it may be a more overarching problem.