Skip to content

Instantly share code, notes, and snippets.

@tylermilner
Last active August 24, 2023 17:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tylermilner/860da640d39b808cba0941546eae2a2d to your computer and use it in GitHub Desktop.
Save tylermilner/860da640d39b808cba0941546eae2a2d to your computer and use it in GitHub Desktop.
These are Xcode breakpoints I've found to be very useful to have turned on to help debug iOS applications and spot problems early. After creating each one, right-click on it and click "Move Breakpoint To" -> "User" so that the breakpoint will automatically be active for any Xcode project you open.
All Objective-C Exceptions
// Catches exceptions thrown by Objective-C code.
// Default Xcode breakpoint created by clicking "+" to add breakpoint -> "Exception Breakpoint".
// Change "Exception: All" to "Exception: Objective-C".
-[UIApplication main]
// Helps when printing objects via the debugger by making it aware of the classes in UIKit.
// Symbolic breakpoint created by clicking "+" to add breakpoint -> "Symbolic Breakpoint".
// Enter "-[UIApplication main]" for the Symbol.
// Choose Action -> "Debugger Command".
// Enter "expr @import UIKit" for the command.
// Check "Automatically continue after evaluating actions".
UIViewAlertForUnsatisfiableConstraints
// Helps catch undesirable constraints. Usually, these don't cause obvious visual issues, but they should be fixed since we don't know what could happen in future OS versions.
// Symbolic breakpoint created by clicking "+" to add breakpoint -> "Symbolic Breakpoint".
// Enter "UIViewAlertForUnsatisfiableConstraints" for the Symbol.
-[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:]
// This is another breakpoint that helps to catch undesirable constraints.
// Symbolic breakpoint created by clicking "+" to add breakpoint -> "Symbolic Breakpoint".
// Enter "-[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:]" for the Symbol.
UICollectionViewFlowLayoutBreakForInvalidSizes
// Helps catch undesirable constraints in UICollectionViews.
// Symbolic breakpoint created by clicking "+" to add breakpoint -> "Symbolic Breakpoint".
// Enter "UICollectionViewFlowLayoutBreakForInvalidSizes" for the Symbol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment