Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: mergePolicy #43

Open
wousser opened this issue Jan 17, 2017 · 0 comments
Open

Question: mergePolicy #43

wousser opened this issue Jan 17, 2017 · 0 comments

Comments

@wousser
Copy link

wousser commented Jan 17, 2017

I've tried setting the mergePolicy by loading AERecord with the myOptions parameters, but the mergePolicy option or configuration is not read correctly.

Currently I'm using this code to set the mergePolicy, is this the best (or only) way to do this?

AERecord.Context.default.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy AERecord.Context.background.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy AERecord.Context.main.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy

Full loading code:

`
let myOptions = [NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption : true]
do {
try AERecord.loadCoreDataStack(options: myOptions)
AERecord.Context.default.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
AERecord.Context.background.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
AERecord.Context.main.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy

} catch {
debugPrint(error)
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants