ALMoviePlayerController
ALMoviePlayerController copied to clipboard
In IOS8 operation of direct error
Run in IOS8 directly to the wrong, but I don't know how to solve, can you help us? You are very good, can you solve it
ERR: [[NSException exceptionWithName:@"ALMoviePlayerController Exception" reason:@"Set contentURL after initialization." userInfo:nil] raise];
is your code working on iOS7?
Of course,this code working on iOS7,but iOS8 err
I had the same problem in iOS 7.2 (i think).... to solve it: First initialize the MoviePlayer:
ALMoviePlayerController *moviePlayer = [[ALMoviePlayerController alloc] init];
And then set the content URL:
[moviePlayer setContentURL:[NSURL URLWithString:@"yoururl.com"]];
That made the trick for me!
Cheers!
This most probably happens because iOS 8 changed how MPMoviePlayerViewController is initialized.
thank winterlovesong comment code in ALMoviePlayerController.m file:
/* (id)init { return [self initWithFrame:CGRectZero]; }
(id)initWithContentURL:(NSURL *)url { [[NSException exceptionWithName:@"ALMoviePlayerController Exception" reason:@"Set contentURL after initialization." userInfo:nil] raise]; return nil; } */
@huynv88 - Thank!! its working . But will commenting the code have any adverse effect .
can you help us? ERR: [[NSException exceptionWithName:@"ALMoviePlayerController Exception" reason:@"Set contentURL after initialization." userInfo:nil] raise];
@yangjw This problem has been solved. You can have a look at @JotaP answer.
一看果然是中国人,还给我说英语。
Thank!!! its working.
ex:
-
(id)initWithFrame:(CGRect)frame { if ([[[UIDevice currentDevice] systemVersion] integerValue] >= 8) { self = [super initWithContentURL:nil]; } else { self = [super init]; }
if ( self ) {
self.view.frame = frame; self.view.backgroundColor = [UIColor blackColor]; [self setControlStyle:MPMovieControlStyleNone]; _movieFullscreen = NO; if (!_movieBackgroundView) { _movieBackgroundView = [[UIView alloc] init]; _movieBackgroundView.alpha = 0.f; [_movieBackgroundView setBackgroundColor:[UIColor blackColor]]; }
} return self; }
@shuaiyinoo 已经解决了