Sandeep Bhandari
Sandeep Bhandari

Reputation: 20379

How to declare a Transient variable in coredata entity

I have a coredata entity named Recipient. I need to group the Recipients according to the first character of their name. I am using fetechedresults controller. I need a property which I can provide to NSFetchedResults controller to use it as section key. This property need not be saved in coredata. So I thought of creating a Transient property and provide my own implementation of setter and getter for that property.

Application crashing saying no such property found in Recipient entity. Please help.

In Recipient.h I have

@interface Recipient : NSManagedObject
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString * namesFirstCharacter;
@end

In Recipient.m I have

 @dynamic name;
 @ dynamic namesFirstCharacter;

-(NSString *) namesFirstCharacter{
//my coide to return first character of name
}

Upvotes: 2

Views: 649

Answers (1)

Avi
Avi

Reputation: 7552

Don't use a transient property. Instead, simply create a method or define a readonly property, and give the method or property name to the FRC.

Upvotes: 1

Related Questions