Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data saving problem: can't update transformable attribute (NSArray)
    primarykey
    data
    text
    <p>I have a strange problem in my Core Data app.</p> <p>I have three entities in my app, but today I found a problem with one of them. My problematic entity is called <code>Invoice</code> and it has many attributes, including <code>Products</code>. It's encoded NSArray of NSDictionaries (via default NSValueTransformer).</p> <p>Everything works fine - i create my invoice, its client, its products, etc. Everything works.</p> <p><strong>But</strong>, 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.</p> <p>The problem is only with my <code>products</code> array - the rest (e.g. payment date, client etc.) saves.</p> <hr> <p><strong>What am I doing</strong></p> <p>I pass my <code>Invoice</code> object via</p> <pre><code>NSManagedObject *inv = [self.fetchedResultsController objectAtIndexPath:indexPath]; invoiceEditor.invoice = inv; </code></pre> <p>And save my data (in my <code>InvoiceEditor</code> VC):</p> <pre><code>[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:&amp;error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } </code></pre> <p>Everythings saves until being terminated: client, products, dates. But only products are 'reseted' after termination.</p> <p>Anybody?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload