Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSmanagedObject copyWithZone issues

I have a custom class Thing:NSManagedObject with an attribute of adminName.

I am trying to create a copyWithZone function in this Thing class, but when I run the app it says setAdminName doesn't exist.

In my implementation file I am using

@dynamic adminName;


-(id) copyWithZone: (NSZone *) zone
{
Thing *regCopy = [[Thing allocWithZone: zone] init];
regCopy.attendeeNum = [self adminName];

return regCopy;
}

I don't believe I can just change @dynamic to @synthesize since I am using Core Data.

like image 259
jdog Avatar asked Aug 24 '26 07:08

jdog


1 Answers

NSManagedObject does not conform to the NSCopying protocol. If you want to create a new record with the same data, just insert a new object and assign the values from the first object to the second object.

like image 158
J2theC Avatar answered Aug 26 '26 01:08

J2theC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!