一个对象可以用下面三种模式打开:
kForRead. An object can be opened for read by up to 256 readers as long as the object is not already open for write or for notify.
kForWrite. An object can be opened for write if it is not already open. Otherwise, the open fails.
kForNotify. An object can be opened for notification when the object is closed, open for read, or open for write, but not when it is already open for notify. See chapter 16, Notification. Applications will rarely need to open an object for notify and send it notification.

如果你要用写方式打开一个对象时返回eWasOpenForRead错误,你可以用upgradeOpen()函数使其从只读方式转换为写方式。同样你可以用downgradeOpen()函数转换为只读模式。如果对象被以修改模式打开,可以用upgradeFromNotify() 转换为写方式,用downgradeToNotify()转换为修改方式。

我在读取db的时候,一般用kForNotify,这样文件在被打开的状态下也可以进行编辑。