Skip to content

Getting warning log when presenting toast #61

@parmar-mehul

Description

@parmar-mehul
//Here is my code
//Usage
AppAlert.showToast(message: LocalizedText.getText(key: .noRecordsFound))

//Code
static func showToast(message:String, title:String? = nil, isWarning: Bool = false) {
		if message == "Request explicitly cancelled." {
			return
		}

		if message.trimmed().count == 0 {
			return
		}

		main_thread {
			var attrs: [NSAttributedString.Key : Any] = [
				.font : UIFont().SemiboldFont(ofSize: 17),
				.foregroundColor: UIColor.colorWhite,
			]
			var image = UIImage.init(named: "AppLogo")!

			if isWarning {
				attrs = [
					.font : UIFont().SemiboldFont(ofSize: 17),
					.foregroundColor: .systemRed,
				]

				image = UIImage.init(named: "img-mhd-uncomplete")!
			}

			var subTitle: NSAttributedString?
			if let title = title, title.count > 0 {
				subTitle = .init(string: title, attributes: attrs)
			}

			let toast = Toast.default(
				image: image,
				title: .init(string: message, attributes: attrs),
				subtitle: subTitle,
				viewConfig: .init(
					darkBackgroundColor: .colorBackground,
					lightBackgroundColor: .colorBackground,
					titleNumberOfLines: 0,
					subtitleNumberOfLines: 0))

			if isWarning {
				toast.show(haptic: .warning)
			}
			else {
				toast.show(haptic: .success)
			}
		}
	}

IMG_9876

◾️ 04:22:51.975 PM: Analytics event: i_ma_notifications

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. 
(
    "<NSLayoutConstraint:0x303316620 UIImageView:0x11f9cc200.width == 28   (active)>",
    "<NSLayoutConstraint:0x3033140f0 'UISV-canvas-connection' Toast.IconAppleToastView:0x11f9cc600.leading == UIImageView:0x11f9cc200.leading   (active)>",
    "<NSLayoutConstraint:0x303314500 'UISV-canvas-connection' H:[UIStackView:0x11f9fd180]-(0)-|   (active, names: '|':Toast.IconAppleToastView:0x11f9cc600 )>",
    "<NSLayoutConstraint:0x303314550 'UISV-spacing' H:[UIImageView:0x11f9cc200]-(15)-[UIStackView:0x11f9fd180]   (active)>",
    "<NSLayoutConstraint:0x303317570 'UIView-Encapsulated-Layout-Width' Toast.IconAppleToastView:0x11f9cc600.width == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x303316620 UIImageView:0x11f9cc200.width == 28   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
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. 
(
    "<NSLayoutConstraint:0x3033140f0 'UISV-canvas-connection' Toast.IconAppleToastView:0x11f9cc600.leading == UIImageView:0x11f9cc200.leading   (active)>",
    "<NSLayoutConstraint:0x303314500 'UISV-canvas-connection' H:[UIStackView:0x11f9fd180]-(0)-|   (active, names: '|':Toast.IconAppleToastView:0x11f9cc600 )>",
    "<NSLayoutConstraint:0x303314550 'UISV-spacing' H:[UIImageView:0x11f9cc200]-(15)-[UIStackView:0x11f9fd180]   (active)>",
    "<NSLayoutConstraint:0x303317570 'UIView-Encapsulated-Layout-Width' Toast.IconAppleToastView:0x11f9cc600.width == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x303314550 'UISV-spacing' H:[UIImageView:0x11f9cc200]-(15)-[UIStackView:0x11f9fd180]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
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. 
(
    "<NSLayoutConstraint:0x3033165d0 UIImageView:0x11f9cc200.height == 28   (active)>",
    "<NSLayoutConstraint:0x303314780 'UISV-canvas-connection' Toast.IconAppleToastView:0x11f9cc600.top == _UILayoutSpacer:0x302f64a50'UISV-alignment-spanner'.top   (active)>",
    "<NSLayoutConstraint:0x303316080 'UISV-canvas-connection' Toast.IconAppleToastView:0x11f9cc600.centerY == UIImageView:0x11f9cc200.centerY   (active)>",
    "<NSLayoutConstraint:0x303315cc0 'UISV-spanning-boundary' _UILayoutSpacer:0x302f64a50'UISV-alignment-spanner'.top <= UIImageView:0x11f9cc200.top   (active)>",
    "<NSLayoutConstraint:0x303316170 'UIView-Encapsulated-Layout-Height' Toast.IconAppleToastView:0x11f9cc600.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x3033165d0 UIImageView:0x11f9cc200.height == 28   (active)>

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions