Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 621
Lagubull Avatar asked Feb 04 '16 10:02

Lagubull


1 Answers

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]

like image 158
Lagubull Avatar answered Oct 22 '22 18:10

Lagubull