Lagubull
Lagubull

Reputation: 231

Property not found on object of … error debugging properties on NSManagedObjects

I created a new project with objective-c using coredata as so many times before, but I noticed the newer Xcode is not allowing me to debug the properties on my NSManagedObject which refer to another different NSManagedObject.

Let me explain with an example. MLP stands for MyLittleProject

I have the following objects:

MLPPerson+CoreDataProperties.h

@property (nullable, nonatomic, retain) MLPCard *card;

MLPCard+CoreDataProperties.h

@property (nullable, nonatomic, retain) NSString *cardID;

when I am in the code and try:

NSLog(@“%@“, myPerson.card.cardID);

it works great, however when I try to print in the debug console:

po myPerson.card.cardID

I get an error:

error: property ‘card' not found on object of type ‘MLPPerson *'

I am quite confused as this used to work great in older projects I worked on.

Upvotes: 5

Views: 1300

Answers (1)

Lagubull
Lagubull

Reputation: 231

I found the answer: the reason why this worked before is because the properties were in a class and now they are in a category.

i.e. the content of MLPPerson+CoreDataProperties.h in other projects was part of MLPPerson.h.

Now, to make the debug console print these, you need use

po [myPerson card] cardID]

Upvotes: 15

Related Questions