Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios '-[AVPlayer superview]:发送到实例0x21011ad0'的无法识别的选择器;_Ios_Objective C_Avfoundation_Avplayer_Unrecognized Selector - Fatal编程技术网

Ios '-[AVPlayer superview]:发送到实例0x21011ad0'的无法识别的选择器;

Ios '-[AVPlayer superview]:发送到实例0x21011ad0'的无法识别的选择器;,ios,objective-c,avfoundation,avplayer,unrecognized-selector,Ios,Objective C,Avfoundation,Avplayer,Unrecognized Selector,每当我尝试播放视频时,我的应用程序总是崩溃,尽管我的AVPlayer实例被保留 NSURL *url = [[NSBundle mainBundle] URLForResource:@"dd4dcafeea5111e1ad6712313b030e5d" withExtension:@"mp4"]; self.videoPlayer = [AVPlayer playerWithURL:url]; [self addSubview:self.videoPlayer]; [((AVPlayer *)

每当我尝试播放视频时,我的应用程序总是崩溃,尽管我的AVPlayer实例被保留

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;

这是怎么回事?我没有保留我应该保留的东西吗?

AVPlayer
不是
UIView
的子类。无法将模型对象添加到视图层次结构中