Understanding and working with the different ways to represent nothingness in Objective-C (Null, nil, Nil, l, NSNull) can be extremely confusing and can lead to bugs and wasted time.
Previously I mentioned a project providing an NSObject that causes NSNull to return nil in many cases where NSNull would cause an exception to be thrown which can help cut down on the number of if statements required to validate objects.
Matt Thompson has written a great guide explaining the differences between each of these different representations that should prove very helpful in avoiding any complications that can arise.
You can find the guide on the NSHipster site here.
A nice straightforward explanation of one of those potentially annoying Objective-C idiosyncrasies.
- NSNull Category That Returns Nil Rather Than Throwing Exceptions When Using Null Objects
- Using iPhone Core Data vs. A Database
- (ARC) Automatic Reference Counting Tutorial And Guide Page
- Open Source Library That Enhances Objective-C (Blocks, Protocols, Categories, More)
- Tutorial: iOS Objective-C Unit Testing Frameworks And How To Use Them
Original article: Tutorial: The Differences Between Objective-C NULL, nil, Nil and NSNull Explained
©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.