使用非可选值iOS保存核心数据NSManagedObjectContext时出错

时间:2016-03-18 15:31:06

标签: ios core-data

这是我的dat模型:

  >>> scipy.interpolate.interp1d(x, y, kind='cubic')(1.5)
array(1.265624999999932)

我在私人队列MOC上创建地址。

当我写这篇文章时:

Contact.address————(optional = true, delete rule = cascade)—————>>Address

Address.contact————(optional = false, delete rule = nullify)—————>Contact
Address. apartment———————(optional = true, delete rule = cascade)———>Apartment
Address.landmarks————(optional = true, delete rule = cascade)———>>Landmark

它给了我这个错误:

contact.address = nil <— I am hoping that doing so will delete address entity from database
moc.save()  <— main thread MOC

原因是什么?

我认为Error Domain=NSCocoaErrorDomain Code=1570 "The operation couldn’t be completed. (Cocoa error 1570.)" UserInfo=0x7fa3f2dafc20 {NSValidationErrorKey=contact, NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1570.), NSValidationErrorObject=<PROJ.Address: 0x7fa3f2f9bbf0> (entity: Address; id: 0xd000000000040008 <x-coredata://E756D530-F841-4F78-AC7F-C50BE4DB88BD/XmppContact/p1> ; data: { street = Bla Bla Road; contact = nil; apartment = "0xd00000000004000a <x-coredata://E756D530-F841-4F78-AC7F-C50BE4DB88BD/Apartment/p1>"; landmarks = "<relationship fault: 0x7fa3f2e70f80 'landmarks’>”; })} 是零,这就是它显示错误的原因 如果是,那么如何从contact删除address

0 个答案:

没有答案