magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.8k forks source link

MagicalRecord database for multiple users #1269

Closed mihaipuscasimprezzio closed 7 years ago

mihaipuscasimprezzio commented 7 years ago

Hi, is there a way to set a new database for each user, based on their id to create different files, so when the app launches the store for the current logged in user?

vitalys commented 7 years ago

It's easy. Create unique DB name for your user and use this name in setup method:

[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed: dbName]

mihaipuscasimprezzio commented 7 years ago

Hi,

Ok, and in order to change the DB for the new user should i call 'cleanUp' before 'setupCoreDataStackWithAutoMigratingSqliteStoreNamed' ?

Thanks

On 25 Oct 2016, at 19:57, Vitaly S. notifications@github.com<mailto:notifications@github.com> wrote:

It's easy. Create unique DB name for your user and use this name in setup method:

This message may be subject to nondisclosure, copyright and privacy policy. If you have received this message in error, please notify the sender

vitalys commented 7 years ago

You have to call cleanUp before setup new core data stack.