ALMoviePlayerController icon indicating copy to clipboard operation
ALMoviePlayerController copied to clipboard

In IOS8 operation of direct error

Open shuaiyinoo opened this issue 10 years ago • 10 comments

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];

shuaiyinoo avatar Jun 11 '14 09:06 shuaiyinoo

is your code working on iOS7?

l4u avatar Jun 11 '14 10:06 l4u

Of course,this code working on iOS7,but iOS8 err

shuaiyinoo avatar Jun 12 '14 01:06 shuaiyinoo

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!

JotaP avatar Jun 23 '14 21:06 JotaP

This most probably happens because iOS 8 changed how MPMoviePlayerViewController is initialized.

0xced avatar Aug 20 '14 12:08 0xced

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; } */

huy-van-nguyen avatar Sep 23 '14 07:09 huy-van-nguyen

@huynv88 - Thank!! its working . But will commenting the code have any adverse effect .

bablu-joshi avatar Sep 24 '14 09:09 bablu-joshi

can you help us? ERR: [[NSException exceptionWithName:@"ALMoviePlayerController Exception" reason:@"Set contentURL after initialization." userInfo:nil] raise];

yangjw avatar Sep 28 '14 03:09 yangjw

@yangjw This problem has been solved. You can have a look at @JotaP answer.

一看果然是中国人,还给我说英语。

shuaiyinoo avatar Sep 28 '14 03:09 shuaiyinoo

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; }

yangjw avatar Sep 28 '14 03:09 yangjw

@shuaiyinoo 已经解决了

yangjw avatar Sep 28 '14 03:09 yangjw