I'm assuming that your notificationarray
was created with a call to [NSJSONSerialization JSONObjectWithData:options:encoding:]
. That call will happily give you an array that contains instances of NSNull
if there are null
objects in the JSON being parsed.
Your client code should be robust against an uncooperative data provider. You should check the class of your [notificationarray objectAtIndex:indexPath.row]
. If you're hoping for the object to be an NSDictionary
then you could check like this:
id theObject = [notificationarray objectAtIndex:indexPath.row];
if ([theObject isKindOfClass:[NSDictionary class]]) {
// Work under the assumption that theObject is a dictionary.
} else {
// Log an error, bail out, etc. Whatever's the appropriate
// response for malformed data.
}