hit counter

Timeline

My development logbook

NSInvalidArgumentException When Using Count

Oops.

1
2
2013-12-03 22:01:10.281 Questions[50951:70b] -[NSNull count]: unrecognized selector sent to instance 0x101cb4b40
2013-12-03 22:01:10.311 Questions[50951:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull count]: unrecognized selector sent to instance 0x101cb4b40'

Solution:

Check if the target is indeed an array

1
2
3
4
if ([anObject isKindOfClass:[NSArray class]]) { // Add a check here
    NSInteger count = [anObject count];
    ...
}