Parcourir la source

sharing: fix exception when touch the share button on iPad on iOS 8 (closes #13419)

Felix Paul Kühne il y a 10 ans
Parent
commit
8238f3f3e3
2 fichiers modifiés avec 5 ajouts et 2 suppressions
  1. 2 0
      Sources/VLC for iOS-Prefix.pch
  2. 3 2
      Sources/VLCPlaylistViewController.m

+ 2 - 0
Sources/VLC for iOS-Prefix.pch

@@ -31,6 +31,8 @@
 
 #define SYSTEM_RUNS_IOS7_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
 
+#define SYSTEM_RUNS_IOS8_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")
+
 #ifndef NDEBUG
 #define APLog(format, ...) NSLog(format, ## __VA_ARGS__)
 #else

+ 3 - 2
Sources/VLCPlaylistViewController.m

@@ -1337,7 +1337,6 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
     else
         indexPaths = [self.tableView indexPathsForSelectedRows];
 
-
     NSUInteger count = indexPaths.count;
     if (count) {
         NSMutableArray /* NSURL */ *fileURLobjects = [[NSMutableArray alloc] initWithCapacity:count];
@@ -1392,6 +1391,9 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
                 };
 
                 UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:fileURLobjects applicationActivities:@[_openInActivity]];
+                if (SYSTEM_RUNS_IOS8_OR_LATER)
+                    controller.popoverPresentationController.sourceView = self.navigationController.toolbar;
+
                 controller.completionHandler = ^(NSString *activityType, BOOL completed) {
                     APLog(@"UIActivityViewController finished with activity type: %@, completed: %i", activityType, completed);
 
@@ -1411,7 +1413,6 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
                     // Just in case, we could call enableInteractionBlock here. Since we are disabling touch interaction for the entire UI, to be safe that we return to the proper state: re-enable everything (if presentViewController:animated:completion: failed for some reason). But UIApplication gives us a warning even if we check isIgnoringInteractionEvents, so do not call it for now.
                     // enableInteractionBlock();
                 };
-
                 [self.navigationController presentViewController:controller animated:YES completion:enableInteractionBlock];
             });
             return;