gpt4 book ai didi

objective-c - committedValuesForKeys 在 NSManaged 对象子类上返回一个空字典

转载 作者:搜寻专家 更新时间:2023-10-30 20:19:56 28 4
gpt4 key购买 nike

我正在使用由 XCode 中的核心数据 GUI 工具生成的 NSManaged 对象子类。

对对象进行 NSLog 显示它已正确实例化并保存值......但是如果我尝试使用这样的东西:

[generatedSubClass committedValuesForKeys:nil]

我得到了一个空字典。

最佳答案

文档声明 committedValuesForKeys

Returns a dictionary of the last fetched or saved values of the receiver for the properties specified by the given keys.

因此,您正在发送消息的对象不是最后一次获取或保存的。

另外,请注意 committedValuesForKeys 是实例方法,而不是类方法。

因此,不是 [managedObjectSubclass committedValuesForKeys:nil]
但是 [aManagedObject committedValuesForKeys:nil]

关于objective-c - committedValuesForKeys 在 NSManaged 对象子类上返回一个空字典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14572096/

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