I am using transient attributes as a nice and efficient way to display formatted data (with line breaks) in an NSTableView, and am running into trouble in my awakeFromFetch: method for a subclass of NSManagedObject.

This works fine in the awakeFromFetch: when building a transient attribute based on permanent attributes of the object in question, but

I'm trying to follow relationships to retrieve attributes from several other NSManagedObjects.

The relationship is to the correct NSManagedObject, which is a fault, as seen here:

12/14/08 5:50:43 PM myApp[14070] after we get it city = <NSManagedObject: 0x150e4370> (entity: destination_city; id: 0x150d14e0 <x-coredata://E77970B1-4F89-4C1C-B788-334AEEF886EB/destination_city/p22919 > ; data: <fault>)

Trying to access attributes of the relation just fails with a message like:

12/14/08 5:51:19 PM myApp[14070] *** NSRunLoop ignoring exception 'statement is still active' that raised during posting of delayed perform with target 0x14c90c80 and selector 'invokeWithTarget:'


Sample code:

awakeFromFetch: in my NSManagedObject subclass

        NSManagedObject *city = [self valueForKey:@"city"];
        NSManagedObject *state = [self primitiveValueForKey:@"state"];        
        NSManagedObject *country = [self primitiveValueForKey:@"country"];    

// ********* fails on the next statement - city is there, and marked as a default...
        
        NSString *cityName = [city valueForKey:@"city_name"];
        NSString *stateName = [state valueForKey:@"state_name"];
        NSString *countryName = [country valueForKey:@"countryName"];
        
NSString *transient_location = [NSString stringWithFormat:@"%@, %...@\n %@", cityName, stateName, countryName];


displayPatternValue is much slower than this approach and I don't want to denormalize my tables unless I have to do so.

Suggestions?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to