Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 770481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:30:26+00:00 2026-05-14T18:30:26+00:00

How could I use the NSFetchedResultsController with translated sort key and sectionKeyPath? Problem: I

  • 0

How could I use the NSFetchedResultsController with translated sort key and sectionKeyPath?

Problem: I have ID in the property “type” in the database like typeA, typeB, typeC,… and not the value directly because it should be localized. In English typeA=Bird, typeB=Cat, typeC=Dog in German it would be Vogel, Katze, Hund.

With a NSFetchedResultController with sort key and sectionKeyPath on “type” I receive the order and sections
– typeA
– typeB
– typeC

Next I translate for display and everything is fine in English:
– Bird
– Cat
– Dog

Now I switch to German and receive a wrong sort order
– Vogel
– Katze
– Hund

because it still sorts by typeA, typeB, typeC

So I’m looking for a way to localize the sort for the NSFetchedResultsController.

I tried the transient property approach, but this doesn’t work for the sort key because the sort key need to be in the entity.

I have no other idea. But I can’t believe that’s not possible to use NSFetchedResultsController on a derived attribute required for localization?

There are related discussions like Using custom sections with NSFetchedResultsController? but the difference is that the custom section names and the sort key have probably the same order. Not in my case and this is the main difference.

At the end I would need a sort order for the necessary NSSortDescriptor on a derived attribute, I guess. This sort order has also to serve for the sectionKeyPath.

Thanks for any hint.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:30:27+00:00Added an answer on May 14, 2026 at 6:30 pm

    OK, not a nice solution but at the end it’s working (because I have a defined limited set of records ca. 100):

    On intializing the app:

    • I create an “order by” attribute in the managed object.
      • I check if the localization (and with it the sort order) changed since last time. If so:
      • I fetch all the records and sort it in an NSArray by localized names.
      • I write back the records in the store

    For perfomance reason I only fetch and sort records according to a NSPredicate.

    Than I can use all the existing code using the “order by” as sort key and section key path.

    I know that I could use my ordered array as datasource for the table view, but I wanted to keep the existing code and use the methods of NSFetchedResultsController.

    As a convenience of this I have full control over the sorting, that will fit my needs in future since I plan to build a more complex sort ordering (location based, higher probability of use of the records at the top, etc.)

    However it’s not an elegant solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 482k
  • Answers 482k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have to first normalize the strengths, so that their… May 16, 2026 at 6:43 am
  • Editorial Team
    Editorial Team added an answer $solr->deleteByQuery("*:* -id:(12345 OR 12346 OR 12347)") May 16, 2026 at 6:43 am
  • Editorial Team
    Editorial Team added an answer Solution was to put text version to Body, and add… May 16, 2026 at 6:43 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.