Site icon VR SoftCoder

Error: Realm at path /data/user/0/com.drug/files/drugApp.realm already opened on current thread with different schema.

Error Realm at path datauser0com.drugfilesdrugApp.realm already opened on current thread with different schema.

Error Realm at path datauser0com.drugfilesdrugApp.realm already opened on current thread with different schema.

Error: Realm at path ‘/data/user/0/com.drug/files/drugApp.realm’ already opened on current thread with different schema.

To solve this error you need to close Realm instance like below code example:-

export const insertNewContact = newcontact => new Promise((resolve,reject) => {
	Realm.open(databaseOptions).then(realm=>{
		realm.write(() => {
			console.log(newcontact);
		    realm.create(CONTACT_SCHEMA, newcontact);
		    resolve(newcontact);
            realm.close();
		});
	}).catch((error) => reject(error));
});
Exit mobile version