From fa093cc590fae39a3e4f8cbc6f528df2560a5f95 Mon Sep 17 00:00:00 2001 From: Felix Schulze Date: Tue, 4 Nov 2014 21:10:43 +0100 Subject: [PATCH] Restore iOS < 8 compatibility --- FSImageViewer/FSImageViewerViewController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FSImageViewer/FSImageViewerViewController.m b/FSImageViewer/FSImageViewerViewController.m index b0891b6..6191c8b 100644 --- a/FSImageViewer/FSImageViewerViewController.m +++ b/FSImageViewer/FSImageViewerViewController.m @@ -216,8 +216,10 @@ - (void)share:(id)sender { NSAssert(currentImage.image, @"The image must be loaded to share."); if (currentImage.image) { UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[currentImage.image] applicationActivities:_applicationActivities]; - if(!controller.popoverPresentationController.barButtonItem){ - controller.popoverPresentationController.barButtonItem = shareButton; + if([controller respondsToSelector:@selector(popoverPresentationController)]) { + if (!controller.popoverPresentationController.barButtonItem) { + controller.popoverPresentationController.barButtonItem = shareButton; + } } [self presentViewController:controller animated:YES completion:nil]; }