我现在需要如何从托管对象获取图像引用。这是用户滑动并按下删除时的删除部分
if editingStyle == .Delete {
// Delete the row
//
let managedObject: NSManagedObject = frc.objectAtIndexPath(indexPath) as! NSManagedObject
//context.deleteObject(managedObject)//outcommented to test
print("moc \(managedObject)")// i can see the right image file id/name but i don't now how to get it<-------
removeImage("5354B06C-CFCB-4845-BEC3-B4B4855D8A36")//hardcoded to test if removeImage works and it does
do {
print("deleted")
try context.save()
} catch {
print(error)
}
}
要使我的代码工作,我只需要从managedObject获取imagename。当我打印(“moc(managedObject)”)时,我在
中看到了图像名称moc <Appointments: 0x1740c8f10> (entity: Appointments; id: 0xd0000000000c0000 <x-coredata://DE573499-064D-4840-819E-6ED2923E42CC/Appointments/p3> ; data: { appointmentImage = "C374341D-7256-4A67-B836-D82619A64AC8";
appointmentAmount = 258;
我该怎么做?
答案 0 :(得分:3)
使用您的数据模型,而不是将对象强制转换为NSManagedObject。如果约会是你的日期模型,那么试试这个,
File "a.py", line 1, in <module>
import django.core
ImportError: No module named core