[ad_1]
I am presenting a UIAlertController motion sheet on a view controller. This works fantastic on an iPhone. On an iPad I see nothing, however the console warns me about format constraints which appear to set its peak to 0:
2022-02-22 22:00:26.032174+0100 Sandbox[15099:651165] [LayoutConstraints] Unable to concurrently fulfill constraints.
Most likely not less than one of many constraints within the following checklist is one you don't need.
Do this:
(1) have a look at every constraint and take a look at to determine which you do not count on;
(2) discover the code that added the undesirable constraint or constraints and repair it.
(Word: In the event you're seeing NSAutoresizingMaskLayoutConstraints that you do not perceive, seek advice from the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x6000024aecb0 h=--& v=--& UIView:0x155609dd0.width == 0 (lively)>",
"<NSLayoutConstraint:0x6000024ad0e0 UIView:0x15550be40.width == 304 (lively)>",
"<NSLayoutConstraint:0x6000024926c0 _UIAlertControllerView:0x15550b850.width >= UIView:0x15550be40.width (lively)>",
"<NSLayoutConstraint:0x6000024ae260 UIView:0x155609dd0.width == _UIAlertControllerView:0x15550b850.width (lively)>"
)
Will try and get better by breaking constraint
<NSLayoutConstraint:0x6000024ad0e0 UIView:0x15550be40.width == 304 (lively)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this within the debugger.
The strategies within the UIConstraintBasedLayoutDebugging class on UIView listed in <UIKitCore/UIView.h> might also be useful.
2022-02-22 22:00:26.032639+0100 Sandbox[15099:651165] [LayoutConstraints] Unable to concurrently fulfill constraints.
Most likely not less than one of many constraints within the following checklist is one you don't need.
Do this:
(1) have a look at every constraint and take a look at to determine which you do not count on;
(2) discover the code that added the undesirable constraint or constraints and repair it.
(Word: In the event you're seeing NSAutoresizingMaskLayoutConstraints that you do not perceive, seek advice from the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x6000024aed50 h=--& v=--& UIView:0x155609dd0.peak == 13 (lively)>",
"<NSLayoutConstraint:0x600002492710 _UIAlertControllerView:0x15550b850.peak == UIView:0x15550be40.peak (lively)>",
"<NSLayoutConstraint:0x6000024adc70 UIView:0x155609dd0.peak == _UIAlertControllerView:0x15550b850.peak (lively)>",
"<NSLayoutConstraint:0x600002491f90 UIView:0x15550be40.peak >= 44 (lively)>"
)
Will try and get better by breaking constraint
<NSLayoutConstraint:0x600002491f90 UIView:0x15550be40.peak >= 44 (lively)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this within the debugger.
The strategies within the UIConstraintBasedLayoutDebugging class on UIView listed in <UIKitCore/UIView.h> might also be useful.
To breed this, you’ll be able to create a brand new App in Xcode (I am utilizing the choices Storyboard, Goal-C) and alter the ViewController.m code to
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self motion:@selector(gestureRecognized:)]];
}
- (void)gestureRecognized:(id)sender {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:NULL]];
alertController.popoverPresentationController.sourceView = self.view;
[self presentViewController:alertController animated:YES completion:NULL];
}
@finish
In case it issues, I am utilizing Xcode 13.2.1 with iOS 15.2 simulators (iPhone SE – 2nd era and iPad ninth era) however customers with actual units are in a position to reproduce it as properly.
[ad_2]
