Fork me on GitHub

Alex Rupérez

Language: Objective-C
Published: 08 May 21:24
Last push: 09 May 13:18
Description: NSArray+Verified checks NSNull (aka kCFNull) objects and it changes to nil
View on GitHub



In some cases, when you download a JSON object from an API, some field is null or empty, and you check:

if ([JSON objectAtIndex:index]) ...

it returns a NSNull object instead nil, thus a non-null object which pass the "if" checking but it's really nothing, with this method you'll not have more NSNull shit anymore.

- (id)verifiedObjectAtIndex:(NSUInteger)index;

Also check NSDictionary+Verified!

Also check NSObject+NSVerifiedKeyValueCoding!