【发布时间】:2016-06-17 16:23:34
【问题描述】:
节目信息
嗨!我在 Stackoverflow 上发布的第一个问题,这里是: 我目前正在编写一个用于二手零件检查的程序,并且需要能够使用 Core Data(或其他东西,如果推荐的话)保存客户信息。我只需要保存它然后检索它来制作 PDF。
问题
-我在点击保存按钮时收到错误消息: -我不知道如何检索数据并将其转换为 PDF(但这完全是一个单独的问题)
错误
*2016-06-17 11:15:54.336 NewParts[6803:2846480] CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/1AAF2587-19C6-424F-BA3A-F37BBEE4AC71/Documents/SingleViewCoreData.sqlite options:(null) ... returned error Error Domain=NSCocoaErrorDomain Code=134100 "The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store." UserInfo={metadata={
NSPersistenceFrameworkVersion = 641;
NSStoreModelVersionHashes = {
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "F4F8EB7F-B2EB-4D7F-A2A3-45FA91F8582E";
"_NSAutoVacuumLevel" = 2;
},*
保存按钮操作
@IBAction func saveButton(sender: AnyObject)
{
var appDel: AppDelegate = (UIApplication.sharedApplication().delegate as! AppDelegate)
var context:NSManagedObjectContext = appDel.managedObjectContext
var entity1 = NSEntityDescription.insertNewObjectForEntityForName("UsedInfo", inManagedObjectContext:context) as NSManagedObject
entity1.setValue("Test", forKey: "product")
do {
try context.save()
}
catch {
print("error")
}
}
【问题讨论】:
-
值得注意的是,我完全是 iOS/Swift 菜鸟。
标签: ios xcode swift sqlite core-data