gpt4 book ai didi

swift +核心数据: Unable to add managed object after generating its subclass in swift

转载 作者:行者123 更新时间:2023-11-30 10:14:35 24 4
gpt4 key购买 nike

我创建了一个数据模型,如下所示:

enter image description here

将ArrayController实体名称更新为:DownloadingFile,并执行相关绑定(bind):

a. ArrayController 绑定(bind)

enter image description here

b.表列绑定(bind)

enter image description here

c.添加按钮绑定(bind)

enter image description here

我点击了“添加”按钮,它工作正常,正如预期的那样:)

然后我在 swift 中生成了托管对象的子类,突然它开始崩溃,并在控制台中打印出以下堆栈跟踪:

2015-06-21 00:38:13.073 TableViewBindingsSample[2390:48630] Failed to create new object
2015-06-21 00:38:13.075 TableViewBindingsSample[2390:48630] (
0 CoreFoundation 0x00007fff838b703c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8687d76e objc_exception_throw + 43
2 CoreFoundation 0x00007fff838b6e1a +[NSException raise:format:arguments:] + 106
3 AppKit 0x00007fff84fd34c9 _NSSendCommitEditingSelector + 267
4 AppKit 0x00007fff84fd35ab -[NSController _controllerEditor:didCommit:contextInfo:] + 185
5 CoreFoundation 0x00007fff8378e7bc __invoking___ + 140
6 CoreFoundation 0x00007fff8378e612 -[NSInvocation invoke] + 290
7 CoreFoundation 0x00007fff8382e5c6 -[NSInvocation invokeWithTarget:] + 54
8 Foundation 0x00007fff8812b41b __NSFireDelayedPerform + 364
9 CoreFoundation 0x00007fff8380a2e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
10 CoreFoundation 0x00007fff83809f73 __CFRunLoopDoTimer + 1059
11 CoreFoundation 0x00007fff8387d53d __CFRunLoopDoTimers + 301
12 CoreFoundation 0x00007fff837c5608 __CFRunLoopRun + 2024
13 CoreFoundation 0x00007fff837c4bd8 CFRunLoopRunSpecific + 296
14 HIToolbox 0x00007fff8c3cf56f RunCurrentEventLoopInMode + 235
15 HIToolbox 0x00007fff8c3cf1ee ReceiveNextEventCommon + 179
16 HIToolbox 0x00007fff8c3cf12b _BlockUntilNextEventMatchingListInModeWithFilter + 71
17 AppKit 0x00007fff84c429bb _DPSNextEvent + 978
18 AppKit 0x00007fff84c41f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
19 AppKit 0x00007fff84c37bf3 -[NSApplication run] + 594
20 AppKit 0x00007fff84bb4354 NSApplicationMain + 1832
21 TableViewBindingsSample 0x0000000100003c87 main + 87
22 libdyld.dylib 0x00007fff865225c9 start + 1
23 ??? 0x0000000000000003 0x0 + 3
)

所以我尝试用谷歌搜索并找到了开发人员提出的解决方案:Failed to Create Object - Simple Core Data App但就我而言,建议的解决方案不起作用,事实上,我无法将项目名称作为前缀添加到以点分隔的类名中,当我尝试这样做时,Xcode会自动删除添加的点:(

有什么想法吗?

最佳答案

我通过从生成的 NSManagedObject 子类中删除 @objc(EntityName) 来使其工作。

关于 swift +核心数据: Unable to add managed object after generating its subclass in swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30958061/

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