views:

309

answers:

1

I am writing an iPhone app which uses core data for storage. All of my NSManagedObject subclasses has been automatically generated by xcode based on my data model. One of these classes looks like this:

@interface Client :  NSManagedObject  
{
}

@property (nonatomic, retain) NSNumber * rate;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSString * description;
@property (nonatomic, retain) NSSet* projects;

@end

Creating and saving new instances of this class works just fine, but when I try to access the 'description' property of such an instance, the program unexpectedly quits. When running in Instruments, I can see that just before the crash, a lot of memory is rapidly allocated (which is probably why the app quits).

The code where the property is accessed looks like this:

self.clientName = [[client.name copy] autorelease];
self.clientRate = [[client.rate copy] autorelease];
self.textView.text = client.description; // This is where it crashes

Note that the other properties (name and rate) can be accessed without a problem.

So what have I done wrong?

+2  A: 

From the Apple documentation (Core Data programming guide):

Note that a property name cannot be the same as any no-parameter method name of NSObject or NSManagedObject, for example, you cannot give a property the name “description” (see NSPropertyDescription).

As noted by jbrennan, this should be causing the issue you are experiencing.

unforgiven
Yep, that was it. What a relief! Thank you a lot!
MW