【发布时间】:2017-01-14 07:56:09
【问题描述】:
我是 CoreData 的新手,无法理解我的模型有什么问题。当我尝试将持久存储添加到存储协调器时发生错误:
NSPersistentStore *persistentStore = [self.persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:error];
这是一个日志和错误:
> CoreData: sql: CREATE TABLE ZMANAGEDOBJECT ( Z_PK INTEGER PRIMARY KEY,
> Z_ENT INTEGER, Z_OPT INTEGER, ZSECTION.ARTICLES INTEGER, ZTITLE
> INTEGER, ZBOOK.AUTHOR INTEGER, ZNAME INTEGER, ZAUTHOR INTEGER,
> ZPUBLISHER INTEGER, ZSUBTITLE INTEGER, ZTITLE1 INTEGER, ZAUTHOR1
> INTEGER, ZTEXT INTEGER, ZTITLE2 INTEGER, Z_FOK_SECTION.ARTICLES
> INTEGER, ZCREATEDAT TIMESTAMP, ZUPDATEDAT TIMESTAMP, ZID_ VARCHAR,
> ZTYPE BLOB, ZCONTENT BLOB, ZATTRIBUTES BLOB, ZCOVER BLOB, ZIMAGE BLOB
> )
> CoreData: annotation: Disconnecting from sqlite database due to an
> error.
> CoreData: error: (1) I/O error for database at
> /Users/firuznarzikulov/Library/Application
> Support/BahaiAppAdmin/BahaiAppAdmin.sqlite
Error Domain=NSCocoaErrorDomain Code=256 "文件不能被
已打开。” UserInfo={NSSQLiteErrorDomain=1, NSUnderlyingException=I/O
/Users/user/Library/Application
处的数据库错误 支持/App/database.sqlite。 SQLite 错误代码:1,
'靠近“。”:语法错误'}
ManagedObject 是抽象实体,也是除LocalizedString 之外的所有其他实体的父实体。
感谢任何帮助和想法!
【问题讨论】:
标签: ios macos sqlite core-data