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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:24:55+00:00 2026-05-23T20:24:55+00:00

I have a strange problem in my Core Data app. I have three entities

  • 0

I have a strange problem in my Core Data app.

I have three entities in my app, but today I found a problem with one of them. My problematic entity is called Invoice and it has many attributes, including Products. It’s encoded NSArray of NSDictionaries (via default NSValueTransformer).

Everything works fine – i create my invoice, its client, its products, etc. Everything works.

But, when I choose my invoice from a list and then try to edit its products and click ‘Save’ button, my save works only until my app gets terminated.

The problem is only with my products array – the rest (e.g. payment date, client etc.) saves.


What am I doing

I pass my Invoice object via

NSManagedObject *inv = [self.fetchedResultsController objectAtIndexPath:indexPath];
invoiceEditor.invoice = inv;

And save my data (in my InvoiceEditor VC):

[self.invoice setValue:client forKey:@"Client"] // NSDictionary;
[self.invoice setValue:products forKey:@"Products"] // NSArray of NSDictionaries;
[self.invoice setValue:pmDate forKey:@"PaymentDate"] // NSDate;
// other attributes
NSManagedObjectContext *context = self.invoice.managedObjectContext;
NSError *error = nil;
if (![context save:&error]) {
    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    abort();
}

Everythings saves until being terminated: client, products, dates. But only products are ‘reseted’ after termination.

Anybody?

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

    Just found the problem. From Model Object Implementation Guide:

    If there are mutable and immutable versions of a class you use to represent a property—such as NSArray and NSMutableArray—you should typically declare the return value of the get accessor as an immutable object even if internally the model uses a mutable object.

    And my products array was actually a NSMutableArray instance. I solved it by copying products (so I converted mutable array to immutable array). Now it works. 🙂 And I didn’t need to start the bounty…

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

Sidebar

Related Questions

We have very strange problem, one of our applications is continually querying server by
I have installed psyco in one machine with no problem, but i'm getting an
I have a strange 'problem' with one of my created queries. Given the next
i have a strange problem only in Chrome using an iframe but working in
Hallo, I have a quite strange problem in one of my C++ projects: I
I've recently hit a strange problem with my iOS app and have no idea
I have two Core Data entities: Parent and Child . Parent has to-many relationship
I have a strange problem regarding null pointer exception. I'm posting the problematic code
I have a strange problem happening on one page I am making: myDiv.append(<img src='...'
I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed

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.