I am parsing a JSON file.
After getting the NSDictionary, I parse the objects in the dictionary into an array of objects. However, for certain JSON files, I get NULL, wh
The basic problem seems to be that there is no intValue method on the NSNull that you're getting back from the call to valueForKey:.
You could add the intValue method, but what would you have it return for an NSNull? 0? -1?
The code to do that would look something like this.
In MyNullExtensions.h:
@interface NSNull (integer)
-(int) intValue;
@end
And in MyNullExtensions.m:
#import "MyNullExtensions.h"
@implementation NSNull (functional)
-(int) intValue
{
return -1;
}
@end
Later, Blake.