Tutorial :NSFetchedResultsController.sortDescriptor by KeyPath



Question:

How can I set my fetchedResultsController.sortDescriptors to contain a sortdescriptor that uses a keypath, for instance, such as @"foo.name"?

Cheers

Nik


Solution:1

Despite NSSortDescriptor's use of the name “key”, it actually takes a key path, as described in the documentation. So, just create an NSSortDescriptor with your key path as the “key”, and use that.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »