Post

Replies

Boosts

Views

Activity

Help with pointers and debugging UIViewAlertForUnsatisfiableConstraints
Hi folks, I'm trying to debug some broken constraints and I stumbled upon a post on medium that showed how to get the memory address of the view with broken constraints and how to change the bg color for easy debugging. In the post the person show the following code ex [(UIView *)0x7f94ff5b3890 setBackgroundColor: [UIColor greenColor]] It changes the background color of the UIView that has a broken constraint to easily identify it on the app. My goal is to write that code in Swift, since I'm not very familiar with Objective-C and I'd like to know how it looks in Swift. I've got as far as this (fake address for posting purposes) (lldb) ex -l swift -- import Foundation (lldb) ex -l swift -- import UIKit (lldb) ex -l swift -- UnsafeMutableRawPointer(bitPattern: 0x000)?.load(as: UIView.self) (UIView?) $R9 = 0x000 { UIKit.UIResponder = { ObjectiveC.NSObject = {} } } But if I try to print the backgroundColor or any other property, I get this error: 2023-06-29 11:31:22.644347-0300 APP - DBG[...] +[APP.Button frame]: unrecognized selector sent to class 0x000 error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5).. The process has been returned to the state before expression evaluation. Any clues on how to do it or why it is happening? (Also any sessions regarding this kind of debugging is welcome)
1
0
1.2k
Jun ’23