Permalink
Browse files

Use rootViewController property of UIWindow to find rootViewControlle…

…r in case the first subview of UIWindow is not the view of a UIViewController
  • Loading branch information...
1 parent 2f1d1a0 commit 9a18495848a1e916a7d8a0d7c4cb97d3cf9f52ad @tomquist tomquist committed with VilemKurz Mar 5, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 Classes/ShareKit/Core/SHK.m
@@ -194,7 +194,8 @@ - (UIViewController *)getCurrentRootViewController {
if ([nextResponder isKindOfClass:[UIViewController class]])
result = nextResponder;
-
+ else if ([topWindow respondsToSelector:@selector(rootViewController)] && topWindow.rootViewController != nil)
+ result = topWindow.rootViewController;
else
NSAssert(NO, @"ShareKit: Could not find a root view controller. You can assign one manually by calling [[SHK currentHelper] setRootViewController:YOURROOTVIEWCONTROLLER].");
}

0 comments on commit 9a18495

Please sign in to comment.