On Mar 23, 2011, at 12:49, Motti Shneor wrote: > Regarding reset issue, I was curious --- after all, NSManagedObject gets its > initial dictionary from the Model definition somehow, doesn't it?
Managed objects don't "have" dictionaries -- properties aren't implemented that way. They have internal (private) storage that's similar in behavior to instance variables, but isn't actual instance variables. > why can't I do it, or even better, why isn't it implemented as a > NSManagedObject API? You can and it is, but you just missed seeing it in the documentation. Look at NSEntityDescription. Presumably, this is what Core Data itself uses to initialize objects. > Regarding the other issue.... (sigh) > > Well, we are contractors for a big company. They have their old server-client > code modules, and they try to keep them cross-platform (Yup, Windows). That's > why they refrain from any Core-Data direct calls in the background thread > client code. It's not because it's on a thread, it's because this code is not > "Mac only" code. You may have a valid reason, but what you *say* doesn't make any sense. This is what you wrote earlier: > On Mar 23, 2011, at 12:49, Motti Shneor wrote: > >> 2. We have a multithreaded application, and we only keep one core-data >> context. Our network-related code receives data in a background thread, but >> is unable to write it to the model directly. So it saves it in some >> intermediate data object, and passes it to the main-thread for writing into >> the model. >> I would like to use an NSManagedObject to replace the intermediate data >> object --- It is quite ugly to have duplicated model classes definition for >> everything. If the corporate bigwigs are forcing you to use platform-agnostic code for the background thread, then they're forcing you to use platform-agnostic intermediate data objects, and so you wouldn't be trying to replace them with managed objects. If you're free to replace them with managed objects, you're free to use a managed object context (an extra one) in the background thread. Which of the two problems are you trying to (allowed to) solve? _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
