Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
遍历数组并删除每一个(如Delete/Reset all entries in Core Data?所示)真的是唯一的方法吗?或者有没有单行的方法?
并不是我不想输入它,这更多的是性能问题,因为我想尽可能高效地完成它。
您必须遍历您的托管对象数组并一一删除它们。Core Data 不提供批量删除操作。请注意,当您将deleteObject:消息发送到托管对象上下文时,该对象将被标记为删除。实际删除是在保存上下文时执行的。
deleteObject: