Matous Hybl
Matous Hybl

Reputation: 168

Unload Realm because of new database file

I am trying to update precompiled database in my app using a new database file downloaded from the internet. However when I download the file and replace the old one used by Realm with it, Realm still uses the old one till the next app restart. Unfortunately I still need to open the first DB to copy some data from it before downloading a new database. Is there a possiblity to force unload/reload the whole database?

Upvotes: 2

Views: 145

Answers (1)

Matous Hybl
Matous Hybl

Reputation: 168

I made a mistake and I accidentally created a new instance of Realm. The problem is that Realm instances are cached. I needed to use autoreleasepool {} and ensure that Realm is created only in the block.

Upvotes: 1

Related Questions