Xcode com.facebook.JavaScript(11):EXC_BAD_ACCESS(code=1,address=0x20)
Realm Schemas
架构v1:
Schema v2:
v1的领域迁移功能 - > V2:
export function migration(oldRealm: Realm, newRealm: Realm) {
const oldCars = oldRealm.objects(Car.schema.name) as Realm.Results<Car>;
oldCars.forEach((car: any) => {
const carTitle = {
id: car.id,
make: car.make,
year: car.year,
owner: car.owner,
} as CarTitle;
newRealm.create(CarTitle.schema.name, carTitle, true);
});
}
newRealm.create()
引发错误。是否无法在迁移期间从旧领域对象中创建新领域表中的新对象?