gpt4 book ai didi

ios - 核心数据关系错误

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

我想保存一个目标和一个 Actor 。这两个实体与责任关系相关:

Goal *addgoal = (Goal*)[NSEntityDescription insertNewObjectForEntityForName:@"Goal" inManagedObjectContext:context];

addgoal.goalNaam = nameTextField.text;
addgoal.goalId = idField.text;
addgoal.goalBeschrijving = beschrijvingField.text;

Actor *addactor = (Actor*)[NSEntityDescription insertNewObjectForEntityForName:@"Actor" inManagedObjectContext:context];

addactor.actorNaam = responsibleField.text;

[addgoal addResponsibilityObject:addactor];

上面的行 ([addgoal addResponsibility:addactor]) 导致错误,出了什么问题?

在目标.h 中:
@interface Goal (CoreDataGeneratedAccessors)
- (void)addResponsibilityObject:(Actor *)value;
@end

错误:

2012-08-02 20:57:11.838 选择 3[7434:fb03]-[__NSCFSet 实体]:无法识别的选择器发送到实例 0x8877810
2012-08-02 20:57:11.840 Choose3 [7434:fb03] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFSet 实体]:无法识别的选择器发送到实例 0x8877810”

最佳答案

我刚刚遇到了同样的问题。这里的解决方案是,我忘记检查模型检查器中关系选项中的“To-Many”选项。

关于ios - 核心数据关系错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11784067/

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