I’m learning objective-c, working through Aaron Hillegass’ book ‘Cocoa Programming for Mac OS X – Third Edition’. I’m working in Xcode to develop some of the example code, and keep getting a compiler warning on the last line of this method:
- (void) setEntryDate:(NSCalendarDate *) date { [date retain]; [entryDate release]; entryDate = date; }
The warning reads ‘warning: assignment from distinct objective-c type’. What causes this warning? How do I prevent it from happening again?
It doesn’t seem to affect execution of the program, but I don’t understand what the problem is, or even if there really is a problem (could this just be a paranoid compiler?).
NSCalendar and NSCalendarDate are indeed distinct types. You should decide which one you want entryDate to be (probably NSCalendarDate, judging by the ‘date’ thing’).