From 889b01423cbf90beeecdeef17ca76f10615829b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Luthi?= Date: Wed, 4 Jun 2014 23:14:37 +0200 Subject: [PATCH] Handle all ways of initializing XCDYouTubeVideoPlayerViewController --- .../XCDYouTubeVideoPlayerViewController.m | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/XCDYouTubeKit/XCDYouTubeVideoPlayerViewController.m b/XCDYouTubeKit/XCDYouTubeVideoPlayerViewController.m index 0a62f1cac..c20b91e04 100644 --- a/XCDYouTubeKit/XCDYouTubeVideoPlayerViewController.m +++ b/XCDYouTubeKit/XCDYouTubeVideoPlayerViewController.m @@ -26,9 +26,27 @@ @interface XCDYouTubeVideoPlayerViewController () @implementation XCDYouTubeVideoPlayerViewController +/* + * MPMoviePlayerViewController on iOS 7 and earlier + * - (id) init + * `-- [super init] + * + * - (id) initWithContentURL:(NSURL *)contentURL + * |-- [self init] + * `-- [self.moviePlayer setContentURL:contentURL] + * + * MPMoviePlayerViewController on iOS 8 and later + * - (id) init + * `-- [self initWithContentURL:nil] + * + * - (id) initWithContentURL:(NSURL *)contentURL + * |-- [super init] + * `-- [self.moviePlayer setContentURL:contentURL] + */ + - (instancetype) init { - return [self initWithVideoIdentifier:nil]; + return [[[UIDevice currentDevice] systemVersion] integerValue] >= 8 ? [self initWithVideoIdentifier:nil] : [super init]; } - (instancetype) initWithContentURL:(NSURL *)contentURL