Skip to content

Commit

Permalink
Fix iOS viewController is not recognized
Browse files Browse the repository at this point in the history
  • Loading branch information
javaherisaber committed Sep 9, 2022
1 parent 8f62e4c commit 08e4891
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ios/Classes/OpenFilePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
@try {
BOOL previewSucceeded = [_documentController presentPreviewAnimated:YES];
if(!previewSucceeded){
[_documentController presentOpenInMenuFromRect:CGRectMake(500,20,100,100) inView:_viewController.view animated:YES];
[_documentController presentOpenInMenuFromRect:CGRectMake(500,20,100,100) inView:[UIApplication sharedApplication].delegate.window.rootViewController.view animated:YES];
}
}@catch (NSException *exception) {
NSDictionary * dict = @{@"message":@"File opened incorrectly。", @"type":@-4};
Expand Down Expand Up @@ -154,7 +154,7 @@ - (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteraction
}

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {
return _viewController;
return [UIApplication sharedApplication].delegate.window.rootViewController;
}

- (BOOL) isBlankString:(NSString *)string {
Expand Down

0 comments on commit 08e4891

Please sign in to comment.