运行后就崩溃,应该是约束的问题
tuxi opened this issue · comments
第一次运行时出现的错误信息:reason: 'attempting to add unsupported attribute: (null)'
将HcdLightView单例的代码中的约束注释后,拖动滑块出现的错误信息
reason: 'AVPlayerItem cannot service a seek request with a completion handler until its status is AVPlayerItemStatusReadyToPlay.'
详细信息:关于第一次报错问题,我定位到错误是在创建HcdLightView单例的代码中,我把下面代码#warning -----注释了就可以运行起来了,但是拖动播放进步滑块时,还是会奔溃,我用的是Xcode8,请问怎么解决呀
- (instancetype)sharedInstance {
static HcdLightView *instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[HcdLightView alloc] init];
[[UIApplication sharedApplication].keyWindow addSubview:instance];
#warning -----
[instance mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo([UIApplication sharedApplication].keyWindow);
make.centerY.equalTo([UIApplication sharedApplication].keyWindow).offset(-5);
make.width.mas_equalTo(155);
make.height.mas_equalTo(155);
}];
});
return instance;
}
第二个错误注释了seekToTime:CMTimeMakeWithSeconds方法就不报错了
-
(void)seekToTime:(CGFloat)seconds {
if (self.state == HCDPlayerStateStopped) {
return;
}seconds = MAX(0, seconds);
seconds = MIN(seconds, self.duration);[self.player pause];
#warning -----
// [self.player seekToTime:CMTimeMakeWithSeconds(seconds, NSEC_PER_SEC) completionHandler:^(BOOL finished) {
// self.isPauseByUser = NO;
// [self.player play];
// if (!self.currentPlayerItem.isPlaybackLikelyToKeepUp) {
// self.state = HCDPlayerStateBuffering;
//
// self.actIndicator.hidden = NO;
// [self.actIndicator startAnimating];
// // [[XCHudHelper sharedInstance] showHudOnView:_showView caption:nil image:nil acitivity:YES autoHideTime:0];
// }
//
// }];
}