Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting warning log when presenting toast #61

Open
parmar-mehul opened this issue Oct 16, 2024 · 0 comments
Open

Getting warning log when presenting toast #61

parmar-mehul opened this issue Oct 16, 2024 · 0 comments

Comments

@parmar-mehul
Copy link

//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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant