Property cannot be found in forward class object

谁都会走 提交于 2019-11-28 06:40:10
shannoga

This error usually points out that Xcode can not recognize your symbol. I can assume this is DTContact.

Try to insert this in your .h file:

#import DTContact.h

Its not relevant to ur case but I was getting the same error. I googled for a solution but the problem was in my code. I was using different class object as I was copy pasting similar snippet of code in my project. So here is the problem that I had for the same error :

For my classA , I had some code snippet like :

    ManagedObjectOfClassA * managedObjectOfClassA = [NSEntityDescription insertNewObjectForEntityForName:@"ManagedObjectOfClassA"                                                              inManagedObjectContext:managedObjectContext];

    managedObjectOfClassA.somePropertyA = sameValue; //somePropertyA is an attribute of ManagedObjectOfClassA

And similar code for class B :

    ManagedObjectOfClassA *managedObjectOfClassB = [NSEntityDescription insertNewObjectForEntityForName:@"ManagedObjectOfClassB" inManagedObjectContext:managedObjectContext];

    managedObjectOfClassB.somePropertyB = someValue;////somePropertyB is an attribute of ManagedObjectOfClassB

If u look closely, the mistake was in assigning the right entities to the corresponding objects in class B.

So the problem is in code of class B. And the correct code would be :

ManagedObjectOfClassB *managedObjectOfClassB = [NSEntityDescription insertNewObjectForEntityForName:@"ManagedObjectOfClassB" inManagedObjectContext:managedObjectContext];

managedObjectOfClassB.somePropertyB.someValue;

I hope that helps someone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!