• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa-dev Digest, Vol 3, Issue 108
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa-dev Digest, Vol 3, Issue 108


  • Subject: Re: Cocoa-dev Digest, Vol 3, Issue 108
  • From: Ron Lue-Sang <email@hidden>
  • Date: Tue, 24 Jan 2006 14:25:54 -0800

It looks like you're expecting awakeFromInsert to be called when you fetch an object (that's really what you're doing by calling objectWithID:).

awakeFromInsert will get called on the object exactly once in it's lifetime - the first time it's inserted into a context. After that, awakeFromFetch will be called on the object when it's fetched into a context (or, if it's refaulted, when the fault is fired ). So, if understand you correctly, this is the hook you're actually looking for.



-----------------------------
Ronzilla
Core Bindings/Cocoa Data


On Jan 23, 2006, at 10:41 PM, email@hidden wrote:

Date: Tue, 24 Jan 2006 05:04:27 +0200
From: "Rimas M." <email@hidden>
Subject: Core Data + MultiThreading
To: Cocoa-Dev Mail <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Hello,

I have got lots of troubles by trying to solve this question. How to
correctly implement multithreading in Core-Data app. I have found
some examples at ADC, and decided to use multiple NSManagedContexts
(each thread has its own context) controlled by ONE
NSPersistanceStoreCoordinator, and locking contexts. Is that a good
decision?

I am trying in this way:

passing to new thread [NSManagedObject objectID] (to identify object
I want to analyze) and [[NSManagedObject managedObjectContext]
persistanceStoreCoordinator];

in new thread creating new managedContext: myContext =
[[NSManagedContext alloc] init]
and setting coordinator to it: [myContext
setPersistanceStoreCoordinator:__the_one_passed_from_parent_thread__];

finally, if I get managedObject by calling objectWithID, it is in
very 'early' stage. I mean - its properties are exactly, what is
configured by creating new object and described in model. There is no
changes, which should be made by awakeFromInsert.

I have tried to call (void)refreshObject:(NSManagedObject *)object
mergeChanges:(BOOL)flag. Nothing.

Object in original context is correct.

What I am doing wrong? Or maybe there is another way to implement
multithreading?

Any suggestions are welcome.

MR.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Report Conflict: Leaks vs. MallocDebug
  • Next by Date: Get the number of lines of text in an NSTextView?
  • Previous by thread: Re: Contextual Menu Plug-ins for Universal Binaries
  • Next by thread: Get the number of lines of text in an NSTextView?
  • Index(es):
    • Date
    • Thread