Assumptions != NSNotFound
Read OriginalThe article details a specific Objective-C programming pitfall where calling `rangeOfString:` on a nil NSString returns a struct with zeros, not NSNotFound. This causes logic errors, as the check `range.location != NSNotFound` incorrectly passes. It contrasts this with Swift's safer optionals and recommends using `containsString:` on iOS 8+.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser