Ellen Shapiro 11/17/2014

Assumptions != NSNotFound

Read Original

The 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+.

Assumptions != NSNotFound

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week