Property cannot be found in forward class object

后端 未结 2 821
梦谈多话
梦谈多话 2020-12-08 18:25

I\'m adapting This tutorial to my app, and I\'ve got it boiled down to one last error, which is stopping me in my tracks. The program is unable to find a property in another

相关标签:
2条回答
  • 2020-12-08 18:46

    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
    
    0 讨论(0)
  • 2020-12-08 18:48

    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.

    0 讨论(0)
提交回复
热议问题