我的应用程序中有一个DataModel,并且第三次实体松散属性。如果我看看DataModel2.xcdatamodeld,我可以看到那里的属性,但是当我打印我的NSEntityDescription时,我看不到那里的属性。我已经从模拟器中删除了应用程序,清理项目,关闭Xcode并且问题仍然存在。 昨天一切正常,今天我的应用程序崩溃,因为我无法使用缺少的属性“title”保存或获取数据库。
我的NSEntityDescription,您可以看到我不再拥有属性“title”
Optional((<NSEntityDescription: 0x144612d70>) name Movies, managedObjectClassName NSManagedObject, renamingIdentifier Movies, isAbstract 0, superentity name (null), properties {
country = "(<NSAttributeDescription: 0x144529b00>), name country, isOptional 1, isTransient 0, entity Movies, renamingIdentifier country, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
dateadded = "(<NSAttributeDescription: 0x1445299e0>), name dateadded, isOptional 1, isTransient 0, entity Movies, renamingIdentifier dateadded, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 900 , attributeValueClassName NSDate, defaultValue (null)";
file = "(<NSAttributeDescription: 0x1445298c0>), name file, isOptional 1, isTransient 0, entity Movies, renamingIdentifier file, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
genre = "(<NSAttributeDescription: 0x144613410>), name genre, isOptional 1, isTransient 0, entity Movies, renamingIdentifier genre, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
host = "(<NSRelationshipDescription: 0x144528a20>), name host, isOptional 1, isTransient 0, entity Movies, renamingIdentifier host, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, destination entity Hosts2, inverseRelationship movies, minCount 0, maxCount 1, isOrdered 0, deleteRule 1";
label = "(<NSAttributeDescription: 0x144528880>), name label, isOptional 1, isTransient 0, entity Movies, renamingIdentifier label, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
movieid = "(<NSAttributeDescription: 0x144529b90>), name movieid, isOptional 0, isTransient 0, entity Movies, renamingIdentifier movieid, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 200 , attributeValueClassName NSNumber, defaultValue 0";
mpaa = "(<NSAttributeDescription: 0x144528c10>), name mpaa, isOptional 1, isTransient 0, entity Movies, renamingIdentifier mpaa, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
originaltitle = "(<NSAttributeDescription: 0x144528910>), name originaltitle, isOptional 1, isTransient 0, entity Movies, renamingIdentifier originaltitle, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
playcount = "(<NSAttributeDescription: 0x144507eb0>), name playcount, isOptional 1, isTransient 0, entity Movies, renamingIdentifier playcount, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 200 , attributeValueClassName NSNumber, defaultValue 0";
plot = "(<NSAttributeDescription: 0x144528ca0>), name plot, isOptional 1, isTransient 0, entity Movies, renamingIdentifier plot, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
rating = "(<NSAttributeDescription: 0x144529950>), name rating, isOptional 1, isTransient 0, entity Movies, renamingIdentifier rating, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
thumbnail = "(<NSAttributeDescription: 0x144703cb0>), name thumbnail, isOptional 1, isTransient 0, entity Movies, renamingIdentifier thumbnail, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
trailer = "(<NSAttributeDescription: 0x144529a70>), name trailer, isOptional 1, isTransient 0, entity Movies, renamingIdentifier trailer, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)";
year = "(<NSAttributeDescription: 0x144613300>), name year, isOptional 1, isTransient 0, entity Movies, renamingIdentifier year, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 200 , attributeValueClassName NSNumber, defaultValue 0";
}, subentities {
}, userInfo {
}, versionHashModifier (null), uniquenessConstraints (
))
这是第三次发生这种情况,我必须删除数据模型并再次创建以修复它。即使我删除该属性它也无法工作,因为我插入它的任何其他属性都不会在NSEntityDescription中。有一种方法可以解决这个问题,而无需删除整个DataModel?提前谢谢。