I'm just setting the properties to their default values in
awakeFromInitializer, but only if it's a new object.
- (void)awakeFromInitializer {
[super awakeFromInitializer];
if (self.isNew) {
self.name = NSLocalizedString(@"New Pick List", @"");
self.displayAs = kTFSingleSelect;
}
}
There should be no target object ID in this instance though and
awakeFromInitializer is getting called only at the moment I'm checking the
isPopupButton property.
On Monday, March 28, 2016 at 8:45:29 AM UTC-6, Jens Alfke wrote:
>
>
> > On Mar 27, 2016, at 2:52 PM, Brendan Duddridge <[email protected]
> <javascript:>> wrote:
> >
> > So I'm just wondering if it's normal behaviour for an object in a
> relationship to get created simply by following the path to that
> relationship? I would think that it shouldn't automatically be created.
>
> The relationship is stored as a JSON property whose value is the target
> object’s docID. So if the property exists, accessing the property will
> instantiate the target model object, as shown in the backtrace. But if the
> property doesn’t exist, the property getter will just return nil. You can
> look at the implementation of -[CBLModel getModelProperty:]; it’s pretty
> straightforward.
>
> > And then the TFPickList instance gets deallocated, but with unsaved
> properties:
>
>
> Hm, that shouldn’t happen. But why is the TFPickList instance getting
> changed, when it looks like you’re just getting its isPopUpButton property?
> That seems wrong. Are you changing properties in its -awakeFromInitializer
> method?
>
> —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/80b81402-0739-4198-916f-7e5d6c83a926%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.