0

我的應用程序在我試圖播放視頻時一直崩潰,儘管我的AVPlayer實例正在保留。'[AVPlayer superview]:無法識別的選擇器發送到實例0x21011ad0'

NSURL *url = [[NSBundle mainBundle] URLForResource:@"dd4dcafeea5111e1ad6712313b030e5d" withExtension:@"mp4"]; 

self.videoPlayer = [AVPlayer playerWithURL:url]; 
[self addSubview:self.videoPlayer]; 
[((AVPlayer *)self.videoPlayer) play]; 

它被分配到這個屬性:

@property (strong) id videoPlayer; 

這是怎麼回事?我沒有保留我應該的東西嗎?

回答

2

AVPlayer不是UIView的子類。您無法將模型對象添加到視圖層次結構中。

+0

事實證明,你是對的。我需要一個AVPlayerLayer。 – zakdances 2013-03-28 00:31:59

相關問題