1
我想用MPMoviePlayerViewController播放視頻。所以在我的視圖控制器中,我註冊爲MPMoviePlayerLoadStateDidChangeNotification
的觀察者。MPMoviePlayerLoadStateDidChangeNotification適用於iOS 5,但不適用於iOS 6
我再初始化MPMoviePlayerViewController:
self.mPlayerVC = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"<videoURL>"]];
,並等待通知到達。當它執行此代碼時:
MPMoviePlayerController* playerController = notification.object;
if ([playerController loadState] & MPMovieLoadStatePlayable) {
if (self.mPlayerVC) {
[self presentMoviePlayerViewControllerAnimated:self.mPlayerVC];
}
}
任何人都知道爲什麼這適用於iOS 5但不適用於iOS 6?謝謝