It seems that I can't sort on a read-only synthesized property in my 
NSManagedObject subclass. I'd like to sort a bunch of stuff into some sections, 
but the definition of a section is somewhat complex, depending on multiple 
other properties. So, I defined a property "section" like this:

- (NSUInteger)
section
{
        if (self.active.boolValue)
        {
                return 1;
        }
        else if (self.dateClosed != nil)
        {
                return 3;
        }
        else
        {
                return 2;
        }
}

+ (NSSet*)
keyPathsForValuesAffectingSection
{
    return [NSSet setWithObjects: @"active", @"dateClosed", nil];
}

I similarly define a "sectionName" property, but the NSFetchedResultsController 
has no problem using that to section the table view.

Unfortunately, I get an exception when I attempt to execute the fetch while 
sorting on "section". Is there any way to accomplish what I need? 


-- 
Rick



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to