Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.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
从url在iOS中播放视频时获取约束错误?_Ios_Objective C_Iphone_Xcode - Fatal编程技术网

从url在iOS中播放视频时获取约束错误?

从url在iOS中播放视频时获取约束错误?,ios,objective-c,iphone,xcode,Ios,Objective C,Iphone,Xcode,我正在尝试从url在iOS中播放视频。我已在情节提要中添加了一个视图。我已将其位置设置为右下角。我将视频播放器的位置设置为与视图相同的位置。但是,当我播放视频时,会出现错误 Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at eac

我正在尝试从url在iOS中播放视频。我已在情节提要中添加了一个视图。我已将其位置设置为右下角。我将视频播放器的位置设置为与视图相同的位置。但是,当我播放视频时,会出现错误

  Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7ff4314c04c0 H:|-(34)-[MPKnockoutButton:0x7ff431660bc0](LTR)   (Names: '|':_UIBackdropContentView:0x7ff431622240 )>",
    "<NSLayoutConstraint:0x7ff4314d8ac0 H:[MPKnockoutButton:0x7ff431660bc0]-(34)-[MPDetailSlider:0x7ff43161aff0](LTR)>",
    "<NSLayoutConstraint:0x7ff4314d8b10 H:[MPDetailSlider:0x7ff43161aff0]-(34)-[UIView:0x7ff43161e360](LTR)>",
    "<NSLayoutConstraint:0x7ff4317803a0 UIView:0x7ff43161e360.right == _UIBackdropView:0x7ff431615440.right - 34>",
    "<NSLayoutConstraint:0x7ff43161e780 H:|-(0)-[_UIBackdropView:0x7ff431615440]   (Names: '|':MPVideoPlaybackOverlayView:0x7ff4316c8930 )>",
    "<NSLayoutConstraint:0x7ff43161e7d0 H:[_UIBackdropView:0x7ff431615440]-(0)-|   (Names: '|':MPVideoPlaybackOverlayView:0x7ff4316c8930 )>",
    "<NSLayoutConstraint:0x7ff4317bbce0 '_UITemporaryLayoutWidth' H:[MPVideoPlaybackOverlayView:0x7ff4316c8930(111.5)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff4317c9500 h=-&- v=-&- _UIBackdropContentView:0x7ff431622240.midX == _UIBackdropView:0x7ff431615440.midX>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff4317c9550 h=-&- v=-&- _UIBackdropContentView:0x7ff431622240.width == _UIBackdropView:0x7ff431615440.width>"
)

T

实际上,在界面生成器中设置约束时,更容易查看约束。也许您可以提供一个屏幕截图?在界面生成器中设置约束后,实际上更容易查看约束。也许你可以提供一个截图?
    NSURL *fileURL = [NSURL URLWithString:@"http://www.w3schools.com/html/movie.mp4"];
    self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
    CGRect movieFrame;
    movieFrame.size = self.videoView.frame.size;
    [self.moviePlayerController.view setFrame:movieFrame];
    [self.moviePlayerController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.videoView addSubview:self.moviePlayerController.view];
    [self.videoView bringSubviewToFront:self.moviePlayerController.view];
    [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                          attribute:NSLayoutAttributeBottom
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.videoView
                                                          attribute:NSLayoutAttributeBottom
                                                         multiplier:1.0
                                                           constant:0.0]];
        [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                          attribute:NSLayoutAttributeTrailing
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.videoView
                                                          attribute:NSLayoutAttributeTrailing
                                                         multiplier:1.0
                                                           constant:0.0]];
    [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                               attribute:NSLayoutAttributeLeading
                                                               relatedBy:NSLayoutRelationEqual
                                                                  toItem:self.videoView
                                                               attribute:NSLayoutAttributeLeading
                                                              multiplier:1.0
                                                                constant:0.0]];
        [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                               attribute:NSLayoutAttributeTop
                                                               relatedBy:NSLayoutRelationEqual
                                                                  toItem:self.videoView
                                                               attribute:NSLayoutAttributeTop
                                                              multiplier:1.0
                                                                constant:0.0]];
    [self.moviePlayerController play];