• 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: Saving NSManagedObject in Core-Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving NSManagedObject in Core-Data


  • Subject: Re: Saving NSManagedObject in Core-Data
  • From: Felix Franz <email@hidden>
  • Date: Tue, 1 Apr 2008 13:07:58 +0200

On 01.04.2008, at 02:03, malcom wrote:
This is what I've made (suppose you receive a data from a multithreaded socket).

1) You receive the packet
2) Put it into a temp array
3) When you reach a number x of messages you can call the save function


The save function repeats these statements for each packet from the array:
1) Perform insertObject in a second managedObject (connected to the
same persistent store)
2) Get the list of objectID of the object and save it to another array
3) When all packets was saved perform linkMessages function into main
thread passing the objectids array

According to <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#//apple_ref/doc/uid/TP40003385-SW3 > you can only pass ObjectIDs to another thread
if the managed objects were saved. I've never used saving in another object context,
I don't know if it is causing another headache ...


Maybe it is easier to just pass the data to the main thread and perform
the insertion only in the main context?

The recent thread <http://www.cocoabuilder.com/archive/message/cocoa/2008/3/30/202687 > has
some interesting posts on this topic.



Cheers,

felix

_______________________________________________

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


  • Prev by Date: Re: test if another app has hung
  • Next by Date: Exploring AppleScript APIs
  • Previous by thread: Re: test if another app has hung
  • Next by thread: Exploring AppleScript APIs
  • Index(es):
    • Date
    • Thread