Currently I am using the following method to validate the data for not being Null.
if ([[response objectForKey:@"field"] class] != [NSNull class])
NSString *temp = [response objectForKey:@"field"];
else
NSString *temp = @"";
Problem comes when the response Dictionary contains hundreds of attributes (and respective values). I need to add this kind of condition to each and every element for the dictionary.
Any other way around to accomplish?
Any Suggestion for making any change to the web service (except not inserting the null value to database)?
Any Idea, Anyone ??
What I’ve done is put a category on NSDictionary
Then you can just use
[response objectOrNilForKey:@"field"];You can modify this to return a blank string if you’d like.