From 23690b5b733b6271e3708387433618e473985691 Mon Sep 17 00:00:00 2001 From: Rodolfo Date: Sat, 25 Jul 2020 21:57:08 -0500 Subject: [PATCH] Fixed crash on iPad when try to share a photo (#119) --- ios/MerryPhotoView.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ios/MerryPhotoView.m b/ios/MerryPhotoView.m index 4bb9ecc..e81aca9 100644 --- a/ios/MerryPhotoView.m +++ b/ios/MerryPhotoView.m @@ -253,8 +253,13 @@ - (BOOL)photosViewController:(NYTPhotosViewController*)photosViewController capt } - (void)displayActivityViewController:(UIActivityViewController*)controller animated:(BOOL)animated { - - [[self getRootView] presentViewController:controller animated:animated completion:nil]; + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { + [[self getRootView] presentViewController:controller animated:animated completion:nil]; + } + else { + UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:controller]; + [popup presentPopoverFromRect:CGRectMake([self getRootView].view.frame.size.width/2, [self getRootView].view.frame.size.height/2, 0, 0)inView:[self getRootView].view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; + } } - (BOOL)photosViewController:(NYTPhotosViewController*)photosViewController handleLongPressForPhoto:(id)photo withGestureRecognizer:(UILongPressGestureRecognizer*)longPressGestureRecognizer {