Take the 2-minute tour ×

I'm using the following method to determine the number of days between two NSDate's :

- (int)daysBetweenDate:(NSDate *)start andDate:(NSDate *)end {

    NSTimeInterval lastDiff = [start timeIntervalSinceNow];
    NSTimeInterval todaysDiff = [end timeIntervalSinceNow];
    NSTimeInterval dateDiff = lastDiff - todaysDiff;

    double numOfDays = dateDiff/86400; //86400 seconds in a day

    return (int)(numOfDays + 0.5);


And I'm calling it like this:

int numOfDays = [self daysBetweenDate:lastResetDay andDate:[dict objectForKey:@"nsDate"]];

Both values I'm passing in are NSDate's

The above is called while enumerating through an NSMutableArray.

And after running this I'm getting the following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableView timeIntervalSinceNow]: unrecognized selector sent to instance 0x6818600'

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

At some point you're storing a UITableView in something intended to be an NSDate. Debug through your code and check the values in the array, and along the way, and see where you're doing this. ObjC is weakly typed, and an it's easy to put the wrong type into an NSMutableArray because it takes and returns id.

share|improve this answer
add comment

Your Answer


