On Nov 8, 2009, at 2:31 PM, Jerry Krinock wrote:

On 2009 Nov 08, at 13:10, Dave DeLong wrote:

I've come across several guides and documentation that say the fetched properties can be used to mimic smart playlists in iTunes, but I've yet to see any example or explanation on how that can actually be implemented.

I thought that's why they call it "Sample Code" :))

Indeed, and I have been unsuccessful in finding any that demonstrate how to properly use fetched properties. Have you happened to come across any?

I understand that a fetched property is basically a stored fetch request, but from my experimentation, I've only seen how to define the predicate at compile time (in the fetch request editor) and not at runtime.

OK. I was thinking that this might work for your DefaultFolder "in that their predicate is to show everything".

It seems like you're looking for a "user-defined relationship". I'm not a database guru, but I seem to remember reading somewhere that such a thing is a non-starter, particularly in Core Data. My uneducated guess would be that, in this case, you need to remove those relationships from your smart folders and do the filtering in code.

Filtering in code is what I have been doing. In the model I linked to in the OP, you'll see that the AbstractSmartFolder has a predicate attribute. This was a string attribute that I would turn into a predicate for use in a fetch request.

Looking through the documentation, I see that I can retrieve the NSPropertyDescription for a fetched property and change its fetch request. However, I would imagine that that would change the fetch request in all instances of that entity (which I definitely do not want). Is there really no other way to model smart playlists than to store the predicate myself?

Dave

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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