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

  • Home
  • SEARCH
  • 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 3285678
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:17:38+00:00 2026-05-17T20:17:38+00:00

I have the following relationship defined in Core Data Person –> Worked <– Job

  • 0

I have the following relationship defined in Core Data

Person –> Worked <– Job

I have a view that shows Person information in a tableview. The user can then click on Worked Items to see all worked items for that person (Worked entity shows hours worked and related job).
I then push a view showing worked jobs for that person.
I also show, in a picker view, a list of jobs that can be added to the Worked list.

I’ve tried to do this every which way, but I’m not sure if I’m going about the right way, so I’d like the experts’ input on this.

What should I pass into the Worked view? I currently pass in the Person object containing the Worked NSSet to load the table view. Then I use a NSFetchedResultsController to load the picker.
So I got the add functionality working, by using the Person and Job addWorkedObject: methods.
But I need to let the user delete a worked item from the table view.

Should I be using two NSFetchedResults? If so, how?

I’m really at my witt’s end with this one, so if anyone can help, I’d really appreciate it.

Thanks,

Rod

  • 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-17T20:17:38+00:00Added an answer on May 17, 2026 at 8:17 pm

    I’d need a little more information. First, are you relationships uni-directional as your diagram suggests? From what I’ve read, Core Data is much happier with bidirectional relationships.

    For example, this model (below)

    Person <–>> Worked <<–> Job

    states that a Person can ‘have’ many Worked objects, while a Worked object will be associated with at most one Person. Similarly, a Job could be associated with many Worked objects but a Worked object would only ever be associated with at most one Job. Is this your model?

    If so, I would use an NSFetchedResultsController for the root view (the one that is showing all Persons). But I would just use NSSets/NSArrays to populate UITableView and UIPickerView.

    This is a method that I use for debugging – but it might provide a starting point for getting all Jobs, for example. For your purposes, you could populate an ivar NSArray with the NSManagedObjecs in ‘items’.

    - (void) dumpAllObjects:(NSString *) entityDescription
    {
    DLog(@"Dump all object of type '%@']", entityDescription);
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    [fetchRequest setEntity:[NSEntityDescription entityForName:entityDescription
                             inManagedObjectContext:managedObjectContext]];
    
    NSError *error = nil;
    NSArray *items = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
    [fetchRequest release];
    
    DLog(@" There are %d instances of entity '%@'", [items count], entityDescription);
    
    for (NSManagedObject *managedObject in items)
        {
        if ([managedObject respondsToSelector:@selector(dump)])
            [managedObject dump];
        }
    }
    

    Meanwhile, I would subclass UIViewController for your view that shows Worked objects and Job objects – and have that class implement UITableViewDelegate, UITableViewDataSource, UIPickerViewDelegate and UIPickerViewDataSource.

    As for deleting, I am not sure which aspect is causing problems. If you have -addWorkedObject: methods for Person and Job, then you should also have -reomveWorkedObject: methods. No?

    Hope this helps.

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

Sidebar

Related Questions

I have the following tables in my database that have a many-to-many relationship, which
I have three following tables. The relationship is that each report_param and report_frequency is
I have the following table relationship in my database: Parent / \ Child1 Child2
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have a legacy system where the relationship between 2 tables haven't been defined
I have the following tables defined declaratively (very simplified version): class Profile(Base): __tablename__ =
I have the following relationship between two domain classes: class Emp { String name
I'm struggling to model a particular relationship with ActiveRecord. I currently have the following
Trying to use the getDependentRowset in a ZF application. I have the following relationship
I have following situation: I have loged user, standard authentication with DB table $authAdapter

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.