我有一个 iPad 应用程序,使用 XCode 4.5、Storyboards、iOS 6 和 MagicalRecord。此代码导致错误,我不明白为什么。两者aApptStart
和selectedStartDate
都定义为 DateTime。那么,是什么原因造成的呢?
这是有问题的代码:
- (IBAction)saveAppointment:(UIButton *)sender {
NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread];
AppointmentInfo *newAppointment = [AppointmentInfo createEntity]; // create the entity
NSLog(@"Selected start Date (save): %@", [self formatSelectedDate: selectedStartDate]);
newAppointment.aApptStart = selectedStartDate; // <------ causing the error
newAppointment.aApptEnd= selectedEndDate;
newAppointment.aTech = selectedTech;
[localContext MR_saveNestedContexts];
}
这是我得到的错误:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[NSManagedObject setAApptStart:]: unrecognized selector sent to instance 0xee85dd0”