Skip to content

NSError is the standard error handling mechanism in Objective-C, but using it defensively requires more than just passing a pointer. Learn patterns that prevent crashes and make debugging easier.

License

Notifications You must be signed in to change notification settings

BleepingSwift/defensive-coding-nserror-objc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DefensiveCodingNserrorObjc

Sample Objective-C code demonstrating NSError is the standard error handling mechanism in Objective-C, but using it defensively requires more than just passing a pointer. Learn patterns that prevent crashes and make debugging easier..

This project accompanies the article: Defensive Coding with NSError in Objective-C

Requirements

  • Xcode 26.2+
  • iOS 26.0+

Getting Started

  1. Clone this repository
  2. Run xcodegen generate (requires XcodeGen)
  3. Open DefensiveCodingNserrorObjc.xcodeproj
  4. Build and run

What's Included

  • main.m: Source file
  • AppDelegate.h: Source file
  • AppDelegate.m: Source file
  • MyAppError.h: Source file
  • MyAppError.m: Source file
  • DataManager.h: Source file
  • DataManager.m: Source file
  • ErrorHandler.h: Source file
  • ErrorHandler.m: Source file
  • ViewController.h: Source file
  • ViewController.m: Source file

Language

This project is written in Objective-C to demonstrate traditional iOS development patterns.

Learn More

Read the full article at BleepingSwift for detailed explanations and additional examples.

License

MIT License - see LICENSE for details.

About

NSError is the standard error handling mechanism in Objective-C, but using it defensively requires more than just passing a pointer. Learn patterns that prevent crashes and make debugging easier.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors