How do i get current active view controller?
ios, objective-c
Solution
To get the currently visible view you can use:
[self.navigationController visibleViewController];
Problem
I'm having this issue (error is reported by Flurry analytics from some users, but I cannot reproduce it neither on my device nor simulator): `NSInvalidArgumentException: Application tried to present modally an active controller <CityViewController: 0x361b20>.` Do you know anything about this error? Has it happened to you? Application has three hierachically sorted views: master view controller with list of locations and detail view (the CityViewController mentioned in error message) is automatically presented when user is at one of known locations. Whenever location significantly changes, detail view is dismissed first before opening new location to prevent this. However, it apparently doesn't help. CityViewController can also open SMS composer as its child.