I am getting following warning when I try to present a ActivityController on navigation controller,
Attempt to present <UIActivityViewController: 0x15be1d60> on <UINavigationController: 0x14608e80> whose view is not in the window hierarchy!
I have tried to present view controller by following code,
UIActivityViewController * activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
activityController.excludedActivityTypes = excludeActivities;
UIViewController *vc = self.view.window.rootViewController;
[vc presentViewController: activityController animated: YES completion:nil];
[activityController setCompletionHandler:^(NSString *activityType, BOOL completed) {
NSLog(@"completed");
}];
Whats going wrong here ?