2010-08-24 38 views
0

下面的代碼曾用於工作,但現在它不,我沒有改變任何事情。iPhone OS 3.0播放電影不會工作

if ([self respondsToSelector:@selector(presentMoviePlayerViewControllerAnimated:)]) { 
     MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:selectedLink]]; 
     [self presentMoviePlayerViewControllerAnimated:moviePlayer]; 
     [moviePlayer release]; 
    } 
    else { 
     MPMoviePlayerController *moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:selectedLink]] autorelease]; 
     [moviePlayer play]; 
    } 

所以如果操作系統支持的方法presentMoviePlayerViewControllerAnimated我們使用這種方法,但如果其操作系統< 3.2我們用老方法,但是,這並不在我的iPhone第一代OS 3.0.1或iPod Touch的第二工作了gen OS 3.1.3。代碼被觸發時沒有任何反應。

希望你能幫助我。

乾杯

回答

1

啊啊它的自動釋放部分正在做殘骸。

 MPMoviePlayerController *moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:selectedLink]] autorelease]; 
    [moviePlayer play]; 

 MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:selectedLink]]; 
    [moviePlayer play]; 

乾杯

0

我想你必須設置的MPMoviePlayerController視圖幀要顯示它,然後播放前添加此視圖作爲子視圖的CGRect。看看at Apple Documentation

+0

都能跟得上不上3.0+工作,的MPMoviePlayerController沒有一個視圖。 – mbogh 2010-08-24 09:01:21

相關問題