gpt4 book ai didi

objective-c - 发送到 Core Data 的无法识别的选择器导致应用程序崩溃

转载 作者:行者123 更新时间:2023-12-01 18:25:34 25 4
gpt4 key购买 nike

我有一个 iPad 应用程序,使用 XCode 4.5、Storyboards、iOS 6 和 MagicalRecord。此代码导致错误,我不明白为什么。两个aApptStartselectedStartDate被定义为日期时间。那么,是什么原因造成的呢?

这是有问题的代码:

- (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];
}

这是我得到的错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject setAApptStart:]: unrecognized selector sent to instance 0xee85dd0'

最佳答案

So, what is causing this?



该错误表明 AppointmentInfo 中没有该名称的属性。

那么,您的 NSManagedObject 子类 (AppointmentInfo) 是否声明了属性 aApptStart?此外,您的实体是否存在相应的属性(如果该属性已实现 @dynamic 盟友)?

我想它会......也许是一个错字?
你能展示 AppointmentInfo 的接口(interface)和实现吗?

关于objective-c - 发送到 Core Data 的无法识别的选择器导致应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14111882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com