Hi,
So in my awakeFromInitializer I am trying to setup some default values for
my model objects. The problem I'm finding is that when I load my models
from the database, awakeFromInitializer is being called and overwriting the
properties on my model that were read from the database.
So I thought I would add a check to make sure the model object is new
before I set my properties:
- (void)awakeFromInitializer {
[super awakeFromInitializer];
if (self.isNew) {
self.name = NSLocalizedString(@"New Field", @"");
self.fieldType = kFieldTypeText;
}
}
But that didn't work either because my code inside if statement never gets
called after I create my model object. I would think that isNew would be
true, but it appears to be false when newly created.
This is how I'm creating my model objects, so maybe this is the problem:
CBLDocument *fieldDoc = [database documentWithID:[@"fld-"
stringByAppendingString:[Utilities compactUniqueString]]];
TFField *newField = [TFField modelForDocument:fieldDoc];
newField.type = NSStringFromClass([TFField class]);
Am I doing anything wrong here?
Thanks,
Brendan
--
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/f9f60a82-70fc-4740-86c1-d16c987a2410%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.