ios5 - Migrating to iOS 5 Core Data new APIs: understand NSConfinementConcurrencyType -


i'm migrating ios 5 core data new apis , i'm investigating nsconfinementconcurrencytype.

from apple documentation

confinement (nsconfinementconcurrencytype). default. promise context not used thread other 1 on created it. (this same threading requirement you've used in previous releases.)

the thing not obvious me meaning of default in context. mean?

usually, if need perform long import operation in cd, set new nsoperation class , create own context.

- (void)main {     nsmanagedobjectcontext *moc = [[nsmanagedobjectcontext alloc] init];      // other code here... } 

now, can take advantage of parent context , following:

- (void)main {     nsmanagedobjectcontext *moc = [[nsmanagedobjectcontext alloc] init];     [moc setparentcontext:[self mastermoc]];      // other code here... } 

said this, nsconfinementconcurrencytype? typical usage example?

thank in advance.

flex_addicted,

by "default," apple means standard way core data mocs have worked. moc must created on thread upon used. in code above, following standard historically effective moc usage pattern. other styles of mocs create , manage own background queues or bind main queue. can simplify things somewhat. or not. primarily, block oriented interfaces moc. nice have. (while blocks new hotness, not unalloyed good. have seen block oriented code written lazy programmers. leave way complexity in methods. maintenance of such code can quite hard subtle interactions.)

the idea of parent context orthogonal of thread confinement. parent context 1 way associate of parameters needed moc. (apple unclear carried across between mocs. nor discuss merge policy issues.) still have catch, believe, inter-moc notifications.

if may suggest, don't on think these things. changes core data lion/iosv5 quite modest.

andrew


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -