objective c - Backup and Restore realm.io database -


i need backup default realm.io database , restore dropbox. i'm using dropbox-ios-sdk upload , download it. when tried replace current database file (ex. default.realm) backup, rlmrealm object on cache , i'm not able clear cache can't create new instance of database.

can reload rlmrealm object?

here code:

    func reloaddb(frompath: string) {         let defaultparentpath = rlmrealm.defaultrealmpath().stringbydeletinglastpathcomponent         let dbpath = defaultparentpath.stringbyappendingpathcomponent("db.realm")         let dblockpath = defaultparentpath.stringbyappendingpathcomponent("db.realm.lock")          nsfilemanager.defaultmanager().removeitematpath(dbpath, error: nil)         nsfilemanager.defaultmanager().removeitematpath(dblockpath, error: nil)          nsfilemanager.defaultmanager().copyitematpath(frompath, topath: dbpath, error: nil)          self.db = rlmrealm(path: dbpath, readonly: false, error: nil)          nsfilemanager.defaultmanager().removeitematpath(frompath, error: nil)     } 

what best way backup realm.io database?

backing , restoring realm file dropbox should work fine, since database file. however, must make sure don't have references existing realm before deleting it.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -