views:

25

answers:

1

Hi friends

how to compare an adjacent array element that contains date. The thing is when i compare

BOOL day = [[temp_date objectAtIndex:k] compare:[temp_date objectAtIndex:k+1]];

it throughs the following expection

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (23) beyond bounds (23)'

thanks in advance

Regards, sathish

+1  A: 

It seems you do everything correct, just check that you're always within array's bounds. If you do that in a loop the condition may be:

for (int k = 0; k+1 <temp_date.count; ++k)
   ...
Vladimir
thanks for your reply man.
sathish kumar