iOS-Interview-Questions icon indicating copy to clipboard operation
iOS-Interview-Questions copied to clipboard

Add to "Core Data" a Section on "Type Safety && Concurrency"

Open StephenClarkApps opened this issue 8 years ago • 0 comments

A question I have been asked in interview is about whether Core Data typesafe, and how to manage concurrency with Core Data... A simple answer being that Core Data is not typesafe, whilst one may use different queues, with Core Data "Core Data expects to be run on a single thread." (https://cocoacasts.com/core-data-and-concurrency/). You could put different NSManageObjectContext(s) into your app, but you can't share managed object contexts between threads. With the answer you might also want to cover the: three concurrency types , mainQueueConcurrencyType, confinementConcurrencyType, privateQueueConcurrencyType for an NSManagedObjectContext.

StephenClarkApps avatar Jan 23 '18 23:01 StephenClarkApps