Re: NSManagedObject.managedObjectContext is nil???
Re: NSManagedObject.managedObjectContext is nil???
- Subject: Re: NSManagedObject.managedObjectContext is nil???
- From: Rick Mann <email@hidden>
- Date: Wed, 27 Mar 2019 13:18:02 -0700
I can't tell. I don't believe I have any unreferenced MOCs.
> On Mar 27, 2019, at 13:08 , Dave Fernandes <email@hidden> wrote:
>
> Just to clarify, the moc exists, but the reference to it is nil? Or has the
> moc, itself, been deallocated?
>
>> On Mar 27, 2019, at 3:40 PM, Rick Mann <email@hidden> wrote:
>>
>> This is proving very hard to diagnose, as it doesn't always happen. I tried
>> observing -managedObjectContext, but it never gets called with a nil value.
>> Moreover, my entity's -dealloc method is sometimes called even though none
>> of the -awake methods gets called. This is a complex app with a lot of async
>> operation, so this entity gets created and destroyed often, making it that
>> much harder to figure out exactly what's going on.
>>
>> I can bulletproof the place where the crash occurs when the moc is nil, but
>> I'd really like to track down the underlying problem.
>>
>>> On Mar 27, 2019, at 12:17 , Mike Abdullah <email@hidden> wrote:
>>>
>>> Given the number of objects Core Data is designed to juggle, managing that
>>> number of weak references might well affect performance. Besides, wouldn’t
>>> you still the same result, that your object has a nil reference to the
>>> context because the context has been deallocated?
>>>
>>> Furthermore, I think you can also observe this affect on deleted objects
>>> once the context has been saved, if you’re still holding a reference to any
>>> such objects.
>>>
>>> Mike.
>>>
>>> Sent from my iPhone
>>>
>>>> On 26 Mar 2019, at 21:57, Rick Mann <email@hidden> wrote:
>>>>
>>>> The implication there is that an object has a weak reference to the MOC?
>>>> Ah, in the header I see it's `assign`. I wonder why they do that and not
>>>> `weak`.
>>>>
>>>> Thanks, I'll look into it.
>>>>
>>>>> On Mar 26, 2019, at 14:50 , Richard Charles <email@hidden> wrote:
>>>>>
>>>>> You have retained the managed object outside the managed object context.
>>>>>
>>>>> --Richard Charles
>>>>>
>>>>>
>>>>>> On Mar 26, 2019, at 1:04 PM, Rick Mann <email@hidden> wrote:
>>>>>>
>>>>>> I'm seeing a situation where my NSManagedObject's managedObjectContext
>>>>>> is nil. It doesn't happen all the time though. Any idea why? Thanks!
>>>>>>
>>>>>> --
>>>>>> Rick Mann
>>>>>> email@hidden
>>>>>
>>>>
>>>>
>>>> --
>>>> Rick Mann
>>>> email@hidden
>>>>
>>
>>
>> --
>> Rick Mann
>> email@hidden
>
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden