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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:47:17+00:00 2026-05-20T05:47:17+00:00

I have a core data model with an entity called clients that is made

  • 0

I have a core data model with an entity called clients that is made up of the following attributes:

client model entity

If I click on an ‘add client‘ button and bring up the following window:

client window

what would be the correct method to programmatically add a new entry for each property simultaneously (in a similar fashion to how a bound IB ‘add’ button would work with an NSArrayController) and have them appear in the textfields of the ‘add client‘ window to edit? The textfields in the ‘add client‘ window are bound to the corresponding properties (with one or two still missing) of the client entity. The code I have at the moment is:

- (IBAction)addNewClient:(id)sender;
{
    [addClientsWindow makeKeyAndOrderFront:self];
    //NSManagedObjectContext *clientsMoc= [clientsController managedObjectContext];
    //[clientsMoc addObject:[clientsMoc newObject]];
    [clientsController addObject:[clientsController newObject]];
}

Which worked for other entities in this project but isn’t working for client since I added relationship types (it throws up KVC errors in the console). I imagine it’s because I am addressing the NSArrayController rather than the NSManagedObjectContext but the commented out code isn’t working for me. This attempt follows on from a previous question as the question has changed a lot and I’m struggling to implement the advice given. I really need a good starting point and the apple dev docs aren’t helping me make sense of this.

Thanks in advance!

—- Update —-

Am I explaining things badly in this question? I’m new here but thought there might be an attempt at an answer. Googling this was hard for some reason. I may have found something similar to a solution through an unrelated Google search. Luckily it was relevant to this.

- (IBAction)addNewClient:(id)sender;
{
    [addClientsWindow makeKeyAndOrderFront:self];
    NSManagedObjectContext *clientsMoc= [clientsController managedObjectContext];
    NSManagedObject *clientsEntity = [NSEntityDescription
                                     insertNewObjectForEntityForName:@"Clients" 
                                       inManagedObjectContext:clientsMoc];
    [clientsEntity setValue:@"name" forKey:@"clientName"];
    [clientsEntity setValue:@"company" forKey:@"clientCompany"];
    [clientsEntity setValue:@"address" forKey:@"clientAddress"];
    [clientsEntity setValue:@"11111111" forKey:@"clientLandline"];
    [clientsEntity setValue:@"email@gmail.com" forKey:@"clientEmail"];
}

This created a full new entry for the clients entity – I didn’t realise I would have to do an individual value for each property. The KVC errors continued though and I couldn’t find a solution at all. Apple dev docs were actually helpful on this one, here, and adding NSBindingDebugLogLevel 1 to the “Arguments to be passed at launch” list gave me details of exactly what was causing the problem. It was an old binding to an NSTableColumn that hadn’t been updated.

  • 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-20T05:47:18+00:00Added an answer on May 20, 2026 at 5:47 am

    This may be the solution I was after:

    - (IBAction)addNewClient:(id)sender;
    {
        [addClientsWindow makeKeyAndOrderFront:self];
        NSManagedObjectContext *clientsMoc= [clientsController managedObjectContext];
        NSManagedObject *clientsEntity = [NSEntityDescription
                                         insertNewObjectForEntityForName:@"Clients" 
                                           inManagedObjectContext:clientsMoc];
        [clientsEntity setValue:@"name" forKey:@"clientName"];
        [clientsEntity setValue:@"company" forKey:@"clientCompany"];
        [clientsEntity setValue:@"address" forKey:@"clientAddress"];
        [clientsEntity setValue:@"11111111" forKey:@"clientLandline"];
        [clientsEntity setValue:@"email@gmail.com" forKey:@"clientEmail"];
    }
    

    This created a full new entry for the clients entity – I didn’t realise I would have to do an individual value for each property. The KVC errors continued though and I couldn’t find a solution at all. Apple dev docs were actually helpful on this one, here, and adding NSBindingDebugLogLevel 1 to the “Arguments to be passed at launch” list gave me details of exactly what was causing the problem. It was an old binding to an NSTableColumn that hadn’t been updated.

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

Sidebar

Related Questions

I have an entity called Task in my Core Data model. The Task entity
In my Core Data managed object model, I have an entity Foo with a
I have a relationship in a Core Data model that feels like it wants
I have a core data model object called Entry. In this I have an
I have an custom class for an Core Data entity, called 'Friends'. As I
Lets say I have a core data model like this one: Item attributes: name
Given the following Core Data Model: -> : to-one releationship ->>: to-many relationship Entity
I have a set of core, complicated JavaScript data structures/classes that I'd like to
I have an entity called 'SyncInfo' (including a UUID and a modified date) that
I'm using Core data in an iOS project. I have the data model setup

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.