MPMoviePlayerViewController无法同时满足约束

时间:2017-12-15 16:18:12

标签: objective-c ios11 iphone-x xcode9.1

我有一个ios应用程序,它在iPhone X上崩溃在其他iPhone上工作正常。我将objective cXIB一起使用。我已经通过现有的帖子来解决限制问题。这没有帮助。 Xcode版本为9.1 Xcode调试控制台上报告的错误如下。 任何帮助将不胜感激。 谢谢&问候, 勒凯什

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) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x60000028bd60 h=-&- v=-&- _UIBackdropContentView:0x7fb5c34588c0.midY == _UIBackdropView:0x7fb5c3404fa0.midY   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x60000028bc20 h=-&- v=-&- _UIBackdropContentView:0x7fb5c34588c0.height == _UIBackdropView:0x7fb5c3404fa0.height   (active)>",
    "<NSLayoutConstraint:0x600000484510 V:|-(0)-[UIStatusBar_Modern:0x7fb5c34058f0]   (active, names: '|':_UIBackdropContentView:0x7fb5c34588c0 )>",
    "<NSLayoutConstraint:0x600000484600 UIStatusBar_Modern:0x7fb5c34058f0.height == 0   (active)>",
    "<NSLayoutConstraint:0x6000004845b0 V:[UIStatusBar_Modern:0x7fb5c34058f0]-(0)-[UIView:0x7fb5c3431870]   (active)>",
    "<NSLayoutConstraint:0x60000028eba0 UIView:0x7fb5c3431870.top == _UIBackdropView:0x7fb5c3404fa0.top + 44   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000004845b0 V:[UIStatusBar_Modern:0x7fb5c34058f0]-(0)-[UIView:0x7fb5c3431870]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

出现此问题的代码段如下。

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 3.2) {
    NSString *baseUrl = [NSString stringWithFormat:@"file://%@//%@", [[NSBundle mainBundle] resourcePath],[self.video valueForKey:@"VideoFile"]];
    baseUrl = [baseUrl stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
    baseUrl = [baseUrl stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
    NewVideoController *videoController = [[[NewVideoController alloc] initWithContentURL:[NSURL URLWithString:baseUrl]] autorelease];

    [videoController.view setTranslatesAutoresizingMaskIntoConstraints:YES];

    //[videoController.view prepareToPlay];
    //[videoController.view setFrame: self.bounds];  // player's frame must match parent's
    videoController.view.frame = [[UIApplication sharedApplication]keyWindow].bounds;
    //[videoController.view setFrame:CGRectMake(0,150, 320, 200)];
    // ...
    //[videoController play];
    //self.setTranslatesAutoresizingMaskIntoConstraints=YES;
    videoController.moviePlayer.useApplicationAudioSession = NO;
    //videoController.view.translatesAutoresizingMaskIntoConstraints = NO;
    [self presentMoviePlayerViewControllerAnimated:videoController];     
}

Screen shot for UIViewAlertForUnsatisfiableConstraints breakpoint Screen shot for UIViewAlertForUnsatisfiableConstraints breakpoint Screen shot for UIViewAlertForUnsatisfiableConstraints breakpoint Screenshot at breakpoint UIViewAlertForUnsatisfiableConstraints IPhone simulator screen is there. The status bar is overlapped by some element "done" and something

从此断点继续后,视频屏幕将显示在技术模拟器上。在真正的iPhoneX上,它崩溃了。

0 个答案:

没有答案