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 8093685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:33:16+00:00 2026-06-05T20:33:16+00:00

Suppose I have core data entities A and B, where B points to A

  • 0

Suppose I have core data entities A and B, where B points to A via attribute a.

Given the NSEntityDescription for B, and a key path to a given property of A (e.g @”a.name”), is there any way to recover the NSEntityDescription of A?

Thanks,

Tim

  • 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-06-05T20:33:17+00:00Added an answer on June 5, 2026 at 8:33 pm

    I’ve managed to to this by parsing the key path myself:

        // Split the path to the section name up
        NSArray *keyNameParts = [sectionNameKeyPath componentsSeparatedByString:@"."];
    
        // Follow this back to the Entity description for the Section Entity
        for (int idx = 0; idx < keyNameParts.count - 1; idx++) {
            NSDictionary *relationships = entityDescription.relationshipsByName;
            NSString *partName = [keyNameParts objectAtIndex:idx];
            NSRelationshipDescription *relationshipDescription = [relationships objectForKey:partName];
            if (!relationshipDescription)
            {
                [NSException raise:@"Relationship not found for keypath"
                            format:@"Entity '%@' does not point to a relationshop for '%@' in keypath '@'.", entityName, partName, sectionNameKeyPath];
            }
            entityDescription = relationshipDescription.entity;
        } 
    

    If there’s a more direct method I’d love to know it.

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

Sidebar

Related Questions

I have 3 entities in my core data app: Criteria--->>Rank(has 1 attribute:criteriaRank)<<---Option Let's a
I have a few int16 attributes of my core data entities, and I want
This is something I am not sure about in core data. Suppose I have
Suppose I have a 'Tree' entity and an 'Apple' entity in my core data.
Suppose we have the name written in any none-latin letters - languages, like Arabic,
I have a core data entity which has an exclusive one to many relationship
I have created a core data database in one application which involved sucking out
I'm using Core data on my app ok, i have a problem when saving
I have a Core Data List entity that has an ordered relationship to ListItems.
I'm trying to fetch objects from core data that are not in a given

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.