gpt4 book ai didi

ios - Apple CoreData 教程 : What does 'moc = ...' mean?

转载 作者:行者123 更新时间:2023-11-28 06:15:25 25 4
gpt4 key购买 nike

在关于如何从核心数据中获取数据的教程中,我找到了以下代码。

... 运算符是什么?这是什么 moc

我是否应该实现某种协议(protocol)才能访问这些特殊运算符?

感谢您的帮助 enter image description here

最佳答案

CoreData 中的“MOC”指的是 managed object context .

Overview

A context consists of a group of related model objects that represent an internally consistent view of one or more persistent stores. Changes to managed objects are held in memory, in the associated context, until that context is saved to one or more persistent stores. A single managed object instance exists in one and only one context, but multiple copies of an object can exist in different contexts. Thus an object is unique to a particular context.

... 不是实际的代码,它只是表示托管对象上下文的初始化会去那里。

例如:

let moc = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)

关于ios - Apple CoreData 教程 : What does 'moc = ...' mean?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45289765/

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