[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSCFDate



Hi,

I am very puzzled by this error:
- [ NSCFDate daysBefore: ] :  selector not recognized

I have a category on NSCalendarDate
	( NSCalendarDate *)daysBefore:(int)numberOfDays;

It works with
	[  today daysBefore:1 ]
where today is defined as
	NSCalendarDate *today = [ NSCalendarDate calendarDate ];

However, the following code caused the NSCFDate error above:
	Book *aBook = [ bookArray objectAtIndex:i ];
	if ( NSOrderedSame == [ lastEndDate compare:[  [ aBook startDate ] 
daysBefore:1 ] ] )

The class Book declares a method
	( NSCalendarDate *)startDate
	{
		return [ volumeInfo objectForKey:@"startDate" ];
	}

volumeInfo is a dictionary read in using:
	volumeInfo = [ NSDictionary dictionaryWithContentsOfFile:path ];

It was originally created by this statement:
	volumeInfo = [ NSDictionary 
dictionaryWithObjectsAndKeys:PRODUCT_STYLE, @"product", today, 
@"startDate", [ NSCalendarDate distantFuture ], @"endDate",  nil ];

  and saved to file by this method:
         [ volumeInfo writeToFile:path atomically:YES ];

if I break it up and separate the assignment statement, thus:
	NSCalendarDate *bookStartDate = [ aBook startDate ];

	( NSOrderedSame == [ lastEndDate compare:[  bookStartDate 
daysBefore:1 ]  ]  )

and po [ bookStartDate class ] after the assignment,

I get NSCFDate -- which, in fact, does not recognize the selector 
daysBefore:.

Does anyone know  -what is an NSCFDate, under what circumstances does an 
NSCalendarDate become an NSCFDate, and how do I make it stop?

Thanks,
Denise