瀏覽代碼

VLCPlaybackController: The delegate is not always a UIViewController instead use the topmost controller

Carola Nitz 7 年之前
父節點
當前提交
f71180b520
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Sources/VLCPlaybackController.m

+ 4 - 1
Sources/VLCPlaybackController.m

@@ -1195,10 +1195,13 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
                                                                                                                              [self setPlaybackPosition:lastPosition];
                                                                                                                          }]
                                                              ];
+                UIViewController *presentingVC = [UIApplication sharedApplication].delegate.window.rootViewController;
+                presentingVC = presentingVC.presentedViewController ?: presentingVC;
                 [VLCAlertViewController alertViewManagerWithTitle:NSLocalizedString(@"CONTINUE_PLAYBACK", nil)
                                                      errorMessage:[NSString stringWithFormat:NSLocalizedString(@"CONTINUE_PLAYBACK_LONG", nil), item.title]
-                                                   viewController:self.delegate
+                                                   viewController:presentingVC
                                                     buttonsAction:buttonsAction];
+
             }
         }
     }