So to work around it, I'm creating a mutable copy of the values dictionary, then setting my individual properties in the values dictionary, then setting the entire dictionary back using self.values = [NSDictionary dictionaryWithDictionary:mutableDict];
Does that seem reasonable? I'd love to read the discussion on cocoa-dev if you have a link to that. Thanks! Brendan On Friday, July 17, 2015 at 3:36:15 PM UTC-6, Jens Alfke wrote: > > > On Jul 17, 2015, at 1:17 PM, Brendan Duddridge <[email protected] > <javascript:>> wrote: > > I have a property on my class called "values". It's an NSMutableDictionary. > > However, I guess the JSON parser doesn't like that it's mutable. Is there > a way to tell CBL on iOS that I want my values property to be mutable? > > > CBLModel doesn’t support mutable types. The problem is detecting changes — > if you modify the contents of the dictionary, the dictionary property > itself isn’t changed, so the model object doesn’t know it needs to save > back to the database. (I believe Core Data’s NSManagedObject has the same > limitation.) > > In general, mutable property objects are considered a bad idea by many > people, because the owning object loses control over the property value, > which can be mutated at any moment. (There’s been discussion of this on > cocoa-dev recently.) > > —Jens > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/83e8de33-bcc6-4dfb-846d-db6f449587db%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
