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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:52:41+00:00 2026-06-15T03:52:41+00:00

I’ve been trying to debug this for 2 hours, have to sleep. First, I’ve

  • 0

I’ve been trying to debug this for 2 hours, have to sleep. First, I’ve searched and found many similar posts with they keywords: many entities same type and this one:
Core Data: inverse relationship for two relationships with same type

But to no avail. Here’s what’s happening:
I have a data model with two types. For example, I have a Person, and that person can have 4 lists of emails. The email type is its own thing, so I make the person store 4 distinct sets (relationships) to each list.

Basically, when I retrieve one set, it grabs all of them. All 4 lists are now 1, and it doesn’t seem to matter how I set the inverses. Actually these changes somehow caused the entire thing to not save anything, all nil objects when downloaded. Previous to this, it worked fine (except for shoving all 4 lists into one set). All I updated was the data model for relationships. I may have exported the files in the wrong order, but do not know if that’s related.

I simply can’t find the keyword combination to find if someone’s asked this before. I don’t see how it wouldn’t come up, what I’m doing is basic abstraction. I keep thinking I overlooked one box.

To summarize, I have a person, and person has 2 lists. I add them similar to this:
person.friendEmailsList = downloadedEmailsFromFriends;
person.businessEmailsList = downloadedBusinessEmails;

so later, I access person.friendEmailsList (using the correct core data call, of course), and instead of getting just friends, I get everything… friends, businesses everything

Any suggestions would be appreciated

  • 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-15T03:52:42+00:00Added an answer on June 15, 2026 at 3:52 am

    There are two possible solutions.

    First, you can use the approach you use. Just make sure that you also have corresponding reverse relationships from the other entity. So if you have 2 relationships to the same entity, that entity needs 2 distinct relationships back. E.g.

    Person.friendsLists --->> List
    Person.businessLists --->> List
    
    List.friendPerson ---> Person
    List.businessPerson ---> Person
    

    The more flexible approach would be to have the list have an extra attribute type (could be a number as some kind of enum).

    typedef enum {Friend = 1, Business } ListType;
    

    You could put this into your List.h file. Now, to access just friend lists you can do this:

    NSSet *friendList = [person.lists filteredSetUsingPredicate:
           [NSPredicate predicateWithFormat:@"type = %@", @(Friend)]];
    

    This might be a bit much to type, so you can simplify by putting an accessor method into your Person.m (declare it in .h):

    -(NSSet*)friendsLists {
        return [person.lists filteredSetUsingPredicate:
           [NSPredicate predicateWithFormat:@"type = %@", @(Friend)]];
    }
    

    Now you can access the lists with the usual convenient person.friendsLists.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have been unable to fix a problem with Java Unicode and encoding. The
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.