[英]Create NSManagedObject Subclass from Core Data Data Model in Xcode 6
I've got two entities in a Core Data Data Model. 我在核心数据数据模型中有两个实体。 There is a one to many relationship between them. 它们之间存在一对多的关系。 When I navigate to Editor --> Create NSManagedObject Subclass... , my models are generated but I do not get strongly typed method signatures like - (void)addPhotosObject:(NSManagedObject *)value;
当我导航到编辑器 -> 创建NSManagedObject子类...时 ,生成了我的模型,但没有得到强类型方法签名,例如- (void)addPhotosObject:(NSManagedObject *)value;
on the many side of the relationship. 在关系的许多方面。
According to what I've read, in Xcode 5 at least, this is because the class on the one side of the relationship was created first so the class on the many side of the relationship does not yet exist. 根据我所阅读的内容,至少在Xcode 5中,这是因为关系一侧的类是首先创建的,因此关系多侧的类尚不存在。 The suggestions I see say to to simply Create NSManagedObject Subclass... again and the method should generate methods with strongly typed classes but the method signatures are not changing to strongly type. 我认为建议再次简单地创建NSManagedObject子类... ,该方法应生成具有强类型类的方法,但方法签名不会更改为强类型。
Is there a trick to getting strongly typed method signatures? 获取强类型方法签名是否有技巧?
After deleting the NSManagedObject
subclasses that were initially created by Create NSManagedObject Subclass... and simply re-generating them by selecting Create NSManagedObject Subclass... again, the method signatures ended up strongly typed which gave me a Photo
as a parameter like this - (void)addPhotosObject:(Photo *)value;
删除后NSManagedObject
产生再由他们选择创建NSManagedObject子类通过创建NSManagedObject子类......而仅仅是最初创建的子类......再次,方法签名结束了强类型这给了我一个Photo
作为像这样的参数- (void)addPhotosObject:(Photo *)value;
instead of an NSManagedObject
. 而不是NSManagedObject
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.