I have an ios app and it crashes on iPhone X works fine on other iPhones. I use objective c
with XIB
. I have gone through existing posts for constraints issue. That hasn't helped. The Xcode
version is 9.1 The error reported on the Xcode
debug console is below.
Any help will be appreciated.
Thanks & Regards,
Rakesh
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.
The piece of code where this problem occurs is below.
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];
}
After continuing from this breakpoint the video screen is displayed on tech simulator. On the real iPhoneX it crashes.