Reputation: 1911
I have an entity called Account and I have given this entity a class name of Account instead of the default NSManagedObject. I want to be able to specify objects within my main code to be instances of the class type Account.
For example, I want to be able to declare a method such as -(BOOL)loginTo:(Account *)account
.
How am I meant to go about something like this?
Upvotes: 1
Views: 1270
Reputation: 1019
You need to create an actual Account class that is a subclass of NSManagedObject. Cocoa will then associate the class with the entity, so that new entity instances are of the type Account and vice versa.
Make sure you declare all attributes and relationships so you can access them from the Account class. Declare attributes as properties and use the @dynamic
keyword, so Core Data generates accessor methods for you.
Upvotes: 3